diff --git a/app/assets/javascripts/discourse/app/components/time-shortcut-picker.js b/app/assets/javascripts/discourse/app/components/time-shortcut-picker.js index a7597ec88d1..26a65a0f1c1 100644 --- a/app/assets/javascripts/discourse/app/components/time-shortcut-picker.js +++ b/app/assets/javascripts/discourse/app/components/time-shortcut-picker.js @@ -1,9 +1,4 @@ -import { - START_OF_DAY_HOUR, - laterToday, - now, - parseCustomDatetime, -} from "discourse/lib/time-utils"; +import { laterToday, now, parseCustomDatetime } from "discourse/lib/time-utils"; import { TIME_SHORTCUT_TYPES, defaultTimeShortcuts, @@ -70,12 +65,9 @@ export default Component.extend({ _itsatrap: null, - defaultCustomReminderTime: `0${START_OF_DAY_HOUR}:00`, - @on("init") _setupPicker() { this.setProperties({ - customTime: this.defaultCustomReminderTime, userTimezone: this.currentUser.timezone, hiddenOptions: this.hiddenOptions || [], customOptions: this.customOptions || [], @@ -232,7 +224,16 @@ export default Component.extend({ let dateTime = null; if (type === TIME_SHORTCUT_TYPES.CUSTOM) { - this.set("customTime", this.customTime || this.defaultCustomReminderTime); + const defaultCustomDateTime = this._defaultCustomDateTime(); + this.set( + "customDate", + this.customDate || defaultCustomDateTime.format("YYYY-MM-DD") + ); + this.set( + "customTime", + this.customTime || defaultCustomDateTime.format("HH:mm") + ); + const customDatetime = parseCustomDatetime( this.customDate, this.customTime, @@ -274,4 +275,8 @@ export default Component.extend({ } }); }, + + _defaultCustomDateTime() { + return moment.tz(this.userTimezone).add(1, "hour"); + }, }); diff --git a/app/assets/javascripts/discourse/app/templates/components/time-shortcut-picker.hbs b/app/assets/javascripts/discourse/app/templates/components/time-shortcut-picker.hbs index cda6c49b874..6cde6cbe775 100644 --- a/app/assets/javascripts/discourse/app/templates/components/time-shortcut-picker.hbs +++ b/app/assets/javascripts/discourse/app/templates/components/time-shortcut-picker.hbs @@ -12,7 +12,7 @@