FEATURE: simplifies the same day hour to hour use case in local dates

This commit is contained in:
Joffrey JAFFEUX 2018-06-25 22:16:07 +02:00 committed by GitHub
parent 24dfa1b657
commit acd1693dac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -82,10 +82,15 @@ export default Ember.Component.extend({
"timezones"
)
_setConfig() {
const toTime = this.get("toTime");
if (toTime && !this.get("toDate")) {
this.set("toDate", moment().format(this.dateFormat));
}
const date = this.get("date");
const toDate = this.get("toDate");
const time = this.get("time");
const toTime = this.get("toTime");
const recurring = this.get("recurring");
const format = this.get("format");
const timezones = this.get("timezones");
@ -125,7 +130,7 @@ export default Ember.Component.extend({
config.toTime = toDateTime.format(this.timeFormat);
}
if (!time && !toTime && ["LLL", "LLLL", "LLLLL"].includes(format)) {
if (!time && !toTime && this.get("formats").includes(format)) {
config.format = "LL";
}
@ -133,6 +138,15 @@ export default Ember.Component.extend({
config.toDateTime = toDateTime;
}
if (
time &&
toTime &&
date === toDate &&
this.get("formats").includes(format)
) {
config.format = "LT";
}
this.set("config", config);
},