DEV: remove the includeMidFuture option on future-date-input (#15818)

This option was always on. Essentially, we set it only in two places and always use `|| true` with it.

Note that we're going to switch future-date-input-selector to another source of time shortcuts(https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/lib/time-shortcut.js) and also change its API to make it more customizable. Removing the includeMidFuture option is a part of that change.
This commit is contained in:
Andrei Prigorshnev 2022-02-04 18:33:11 +01:00 committed by GitHub
parent 783912d305
commit 62029ec4eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 4 additions and 13 deletions

View File

@ -79,7 +79,6 @@ export default Component.extend({
now, now,
day: now.day(), day: now.day(),
includeWeekend: this.includeWeekend, includeWeekend: this.includeWeekend,
includeMidFuture: this.includeMidFuture || true,
includeFarFuture: this.includeFarFuture, includeFarFuture: this.includeFarFuture,
includeDateTime: this.includeDateTime, includeDateTime: this.includeDateTime,
canScheduleNow: this.includeNow || false, canScheduleNow: this.includeNow || false,

View File

@ -68,7 +68,7 @@ const TIMEFRAMES = [
buildTimeframe({ buildTimeframe({
id: "two_months", id: "two_months",
format: "MMM D", format: "MMM D",
enabled: (opts) => opts.includeMidFuture, enabled: () => true,
when: (time, timeOfDay) => when: (time, timeOfDay) =>
time.add(2, "month").startOf("month").hour(timeOfDay).minute(0), time.add(2, "month").startOf("month").hour(timeOfDay).minute(0),
icon: "briefcase", icon: "briefcase",
@ -76,7 +76,7 @@ const TIMEFRAMES = [
buildTimeframe({ buildTimeframe({
id: "three_months", id: "three_months",
format: "MMM D", format: "MMM D",
enabled: (opts) => opts.includeMidFuture, enabled: () => true,
when: (time, timeOfDay) => when: (time, timeOfDay) =>
time.add(3, "month").startOf("month").hour(timeOfDay).minute(0), time.add(3, "month").startOf("month").hour(timeOfDay).minute(0),
icon: "briefcase", icon: "briefcase",
@ -84,7 +84,7 @@ const TIMEFRAMES = [
buildTimeframe({ buildTimeframe({
id: "four_months", id: "four_months",
format: "MMM D", format: "MMM D",
enabled: (opts) => opts.includeMidFuture, enabled: () => true,
when: (time, timeOfDay) => when: (time, timeOfDay) =>
time.add(4, "month").startOf("month").hour(timeOfDay).minute(0), time.add(4, "month").startOf("month").hour(timeOfDay).minute(0),
icon: "briefcase", icon: "briefcase",
@ -92,7 +92,7 @@ const TIMEFRAMES = [
buildTimeframe({ buildTimeframe({
id: "six_months", id: "six_months",
format: "MMM D", format: "MMM D",
enabled: (opts) => opts.includeMidFuture, enabled: () => true,
when: (time, timeOfDay) => when: (time, timeOfDay) =>
time.add(6, "month").startOf("month").hour(timeOfDay).minute(0), time.add(6, "month").startOf("month").hour(timeOfDay).minute(0),
icon: "briefcase", icon: "briefcase",

View File

@ -9,7 +9,6 @@
includeDateTime=includeDateTime includeDateTime=includeDateTime
includeWeekend=includeWeekend includeWeekend=includeWeekend
includeFarFuture=includeFarFuture includeFarFuture=includeFarFuture
includeMidFuture=includeMidFuture
includeNow=includeNow includeNow=includeNow
clearable=clearable clearable=clearable
onChangeInput=onChangeInput onChangeInput=onChangeInput

View File

@ -35,7 +35,6 @@
</label> </label>
{{future-date-input {{future-date-input
includeDateTime=true includeDateTime=true
includeMidFuture=true
clearable=true clearable=true
onChangeInput=(action (mut inviteExpiresAt)) onChangeInput=(action (mut inviteExpiresAt))
}} }}

View File

@ -124,7 +124,6 @@
displayLabel=(i18n "user.invited.invite.expires_at") displayLabel=(i18n "user.invited.invite.expires_at")
statusType="close" statusType="close"
includeDateTime=true includeDateTime=true
includeMidFuture=true
clearable=true clearable=true
input=buffered.expires_at input=buffered.expires_at
onChangeInput=(action (mut buffered.expires_at)) onChangeInput=(action (mut buffered.expires_at))

View File

@ -15,7 +15,6 @@
input=(readonly ignoredUntil) input=(readonly ignoredUntil)
includeWeekend=true includeWeekend=true
includeDateTime=false includeDateTime=false
includeMidFuture=true
includeFarFuture=true includeFarFuture=true
onChangeInput=(action (mut ignoredUntil)) onChangeInput=(action (mut ignoredUntil))
}} }}

View File

@ -4,7 +4,6 @@
input=ignoredUntil input=ignoredUntil
includeWeekend=true includeWeekend=true
includeDateTime=false includeDateTime=false
includeMidFuture=true
includeFarFuture=true includeFarFuture=true
onChangeInput=(action (mut ignoredUntil)) onChangeInput=(action (mut ignoredUntil))
}} }}

View File

@ -4,7 +4,6 @@ import buildTimeframes from "discourse/lib/timeframes-builder";
const DEFAULT_OPTIONS = { const DEFAULT_OPTIONS = {
includeWeekend: null, includeWeekend: null,
includeMidFuture: true,
includeFarFuture: null, includeFarFuture: null,
includeDateTime: null, includeDateTime: null,
canScheduleNow: false, canScheduleNow: false,

View File

@ -29,7 +29,6 @@ export default ComboBoxComponent.extend(DatetimeMixin, {
now, now,
day: now.day(), day: now.day(),
includeWeekend: this.includeWeekend, includeWeekend: this.includeWeekend,
includeMidFuture: this.includeMidFuture || true,
includeFarFuture: this.includeFarFuture, includeFarFuture: this.includeFarFuture,
includeDateTime: this.includeDateTime, includeDateTime: this.includeDateTime,
canScheduleNow: this.includeNow || false, canScheduleNow: this.includeNow || false,

View File

@ -22,7 +22,6 @@
{{future-date-input {{future-date-input
displayLabelIcon="far-clock" displayLabelIcon="far-clock"
includeDateTime=true includeDateTime=true
includeMidFuture=true
clearable=true clearable=true
}} }}
{{/styleguide-example}} {{/styleguide-example}}