Skip to content
This repository has been archived by the owner on Aug 20, 2022. It is now read-only.

Commit

Permalink
fix: fix unexpect month changing
Browse files Browse the repository at this point in the history
Fixes #195
  • Loading branch information
fengyuanchen committed Jan 6, 2019
1 parent 9fd4e20 commit a3254ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## next

- Fix wrong future month selection when today is 31 (#195).
- Fix month picking issue when the format only contains `YYYY` and `MM` (#193).

## 1.0.3 (Dec 20, 2018)
Expand Down
8 changes: 5 additions & 3 deletions src/js/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ export default {
}

viewDate.setFullYear(viewYear);
viewDate.setMonth(viewMonth);
viewDate.setDate(getMinDay(viewYear, viewMonth, viewDay));
viewDate.setMonth(viewMonth);
this.renderDays();
break;

Expand All @@ -122,11 +122,13 @@ export default {
case 'month':
viewMonth = $.inArray($target.text(), options.monthsShort);
date.setFullYear(viewYear);
date.setMonth(viewMonth);

// Set date before month to avoid month changing (#195)
date.setDate(getMinDay(viewYear, viewMonth, viewDay));
date.setMonth(viewMonth);
viewDate.setFullYear(viewYear);
viewDate.setMonth(viewMonth);
viewDate.setDate(getMinDay(viewYear, viewMonth, viewDay));
viewDate.setMonth(viewMonth);

if (format.hasDay) {
this.showView(VIEWS.DAYS);
Expand Down

0 comments on commit a3254ae

Please sign in to comment.