mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: simplifies the same day hour to hour use case in local dates
This commit is contained in:
parent
24dfa1b657
commit
acd1693dac
@ -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);
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user