Skip to content

Commit

Permalink
Merge pull request #1006 from jllavec/fix/1005--monthpicker-range-events
Browse files Browse the repository at this point in the history
Month range picker doesn't trigger rangeStart rangeEnd events properly
  • Loading branch information
Jasenkoo authored Oct 9, 2024
2 parents cdf9d0b + ade354a commit 74b1fd3
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/VueDatePicker/composables/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,12 @@ export const setMonthOrYearRange = (
if (rangeDate.length === 2 && rangeDate[1] !== null) {
rangeDate = [];
}

if (!rangeDate.length) {
rangeDate = [date];
emit('range-start', date);
} else if (isDateBefore(date, rangeDate[0])) {
rangeDate.unshift(date);
emit('range-start', rangeDate[0]);
emit('range-start', rangeDate[1]);
} else {
rangeDate[1] = date;
if (isDateBefore(date, rangeDate[0])) rangeDate.unshift(date);
else rangeDate[1] = date;
emit('range-end', date);
}

Expand Down

0 comments on commit 74b1fd3

Please sign in to comment.