Skip to content

Commit

Permalink
Fix #2931 (#2932)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
iTzVirtual00 authored Sep 7, 2024
1 parent 1c53c55 commit 9f3dcd2
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/js/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,20 @@ export default class Actions {
this.display.hide();
break;
case ActionTypes.today: {
const today = new DateTime().setLocalization(
this.optionsStore.options.localization
const day = new DateTime().setLocalization(
this.optionsStore.options.localization
);
this._eventEmitters.updateViewDate.emit(today);
this._eventEmitters.updateViewDate.emit(day);

//todo this this really a good idea?
if (this.validation.isValid(today, Unit.date))
this.dates.setValue(today, this.dates.lastPickedIndex);
if (!this.validation.isValid(day, Unit.date)) break;

if (this.optionsStore.options.dateRange)
this.handleDateRange(day);
else if (this.optionsStore.options.multipleDates) {
this.handleMultiDate(day);
} else {
this.dates.setValue(day, this.dates.lastPickedIndex);
}
break;
}
}
Expand Down

0 comments on commit 9f3dcd2

Please sign in to comment.