FEATURE: Add "Now" as an option (default hidden) to the future date input selector (#10047)

Sometimes you need to schedule things from now onward. "Now" in this case is now + 1 minute. this option is hidden by default.
This commit is contained in:
Martin Brennan
2020-06-15 14:06:03 +10:00
committed by GitHub
parent 0ff86b00cb
commit 35a157619a
3 changed files with 10 additions and 0 deletions

View File

@@ -11,6 +11,7 @@
includeWeekend=includeWeekend
includeFarFuture=includeFarFuture
includeMidFuture=includeMidFuture
includeNow=includeNow
clearable=clearable
none="topic.auto_update_input.none"
onChangeInput=onChangeInput

View File

@@ -18,6 +18,13 @@ function buildTimeframe(opts) {
}
export const TIMEFRAMES = [
buildTimeframe({
id: "now",
format: "h:mm a",
enabled: opts => opts.canScheduleNow,
when: time => time.add(1, "minute"),
icon: "magic"
}),
buildTimeframe({
id: "later_today",
format: "h a",
@@ -214,6 +221,7 @@ export default ComboBoxComponent.extend(DatetimeMixin, {
includeFarFuture: this.includeFarFuture,
includeDateTime: this.includeDateTime,
includeBasedOnLastPost: this.statusType === CLOSE_STATUS_TYPE,
canScheduleNow: this.includeNow || false,
canScheduleToday: 24 - now.hour() > 6
};