Skip to content

A platform for community discussion. Free, open, simple.

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

Martin Brennan35a157619aca
diff --git a/app/assets/javascripts/discourse/app/templates/components/future-date-input.hbs b/app/assets/javascripts/discourse/app/templates/components/future-date-input.hbs
index 6e6b117e087..97bb5ef4384 100644
--- a/app/assets/javascripts/discourse/app/templates/components/future-date-input.hbs
+++ b/app/assets/javascripts/discourse/app/templates/components/future-date-input.hbs
@@ -11,6 +11,7 @@
includeWeekend=includeWeekend
includeFarFuture=includeFarFuture
includeMidFuture=includeMidFuture
+ includeNow=includeNow
clearable=clearable
none="topic.auto_update_input.none"
onChangeInput=onChangeInput
diff --git a/app/assets/javascripts/select-kit/addon/components/future-date-input-selector.js b/app/assets/javascripts/select-kit/addon/components/future-date-input-selector.js
index a2770936e5f..7e286a1f2c3 100644
--- a/app/assets/javascripts/select-kit/addon/components/future-date-input-selector.js
+++ b/app/assets/javascripts/select-kit/addon/components/future-date-input-selector.js
@@ -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
};
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 104edd8793c..56088fe45c9 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -2225,6 +2225,7 @@ en:
time_frame_required: Please select a time frame
auto_update_input:
none: "Select a timeframe"
+ now: "Now"
later_today: "Later today"
tomorrow: "Tomorrow"
later_this_week: "Later this week"