mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 07:01:13 +08:00
FEATURE: simplifies the same day hour to hour use case in local dates
This commit is contained in:
@ -82,10 +82,15 @@ export default Ember.Component.extend({
|
|||||||
"timezones"
|
"timezones"
|
||||||
)
|
)
|
||||||
_setConfig() {
|
_setConfig() {
|
||||||
|
const toTime = this.get("toTime");
|
||||||
|
|
||||||
|
if (toTime && !this.get("toDate")) {
|
||||||
|
this.set("toDate", moment().format(this.dateFormat));
|
||||||
|
}
|
||||||
|
|
||||||
const date = this.get("date");
|
const date = this.get("date");
|
||||||
const toDate = this.get("toDate");
|
const toDate = this.get("toDate");
|
||||||
const time = this.get("time");
|
const time = this.get("time");
|
||||||
const toTime = this.get("toTime");
|
|
||||||
const recurring = this.get("recurring");
|
const recurring = this.get("recurring");
|
||||||
const format = this.get("format");
|
const format = this.get("format");
|
||||||
const timezones = this.get("timezones");
|
const timezones = this.get("timezones");
|
||||||
@ -125,7 +130,7 @@ export default Ember.Component.extend({
|
|||||||
config.toTime = toDateTime.format(this.timeFormat);
|
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";
|
config.format = "LL";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,6 +138,15 @@ export default Ember.Component.extend({
|
|||||||
config.toDateTime = toDateTime;
|
config.toDateTime = toDateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
time &&
|
||||||
|
toTime &&
|
||||||
|
date === toDate &&
|
||||||
|
this.get("formats").includes(format)
|
||||||
|
) {
|
||||||
|
config.format = "LT";
|
||||||
|
}
|
||||||
|
|
||||||
this.set("config", config);
|
this.set("config", config);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user