Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixes the daterange freeze that happens when clicking "Go to today" after selecting a date range that starts after today's date
  • Loading branch information
iTzVirtual00 committed Sep 5, 2024
1 parent 1c53c55 commit 1248eb7
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/js/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,15 @@ export default class Actions {
this.display.hide();
break;
case ActionTypes.today: {
const today = new DateTime().setLocalization(
this.optionsStore.options.localization
);
this._eventEmitters.updateViewDate.emit(today);

//todo this this really a good idea?
if (this.validation.isValid(today, Unit.date))
this.dates.setValue(today, this.dates.lastPickedIndex);
const day = new DateTime().setLocalization(this.optionsStore.options.localization);
this._eventEmitters.updateViewDate.emit(day);
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 1248eb7

Please sign in to comment.