Skip to content

Commit 9f3dcd2

Browse files
authored
Fix #2931 (#2932)
* Fix #2931 Fixes the daterange freeze that happens when clicking "Go to today" after selecting a date range that starts after today's date * Adds back the validation check before setting the date
1 parent 1c53c55 commit 9f3dcd2

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/js/actions.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,20 @@ export default class Actions {
143143
this.display.hide();
144144
break;
145145
case ActionTypes.today: {
146-
const today = new DateTime().setLocalization(
147-
this.optionsStore.options.localization
146+
const day = new DateTime().setLocalization(
147+
this.optionsStore.options.localization
148148
);
149-
this._eventEmitters.updateViewDate.emit(today);
149+
this._eventEmitters.updateViewDate.emit(day);
150150

151-
//todo this this really a good idea?
152-
if (this.validation.isValid(today, Unit.date))
153-
this.dates.setValue(today, this.dates.lastPickedIndex);
151+
if (!this.validation.isValid(day, Unit.date)) break;
152+
153+
if (this.optionsStore.options.dateRange)
154+
this.handleDateRange(day);
155+
else if (this.optionsStore.options.multipleDates) {
156+
this.handleMultiDate(day);
157+
} else {
158+
this.dates.setValue(day, this.dates.lastPickedIndex);
159+
}
154160
break;
155161
}
156162
}

0 commit comments

Comments
 (0)