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

Commit

Permalink
Fix disabled months. Month could be enabled even if it first and last…
Browse files Browse the repository at this point in the history
… day is disabled.
  • Loading branch information
mariomka committed Jan 12, 2019
1 parent 1eb7125 commit 26493f4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion demo/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ new Vue({
datetime12: '2018-05-12T17:19:06.151Z',
datetime13: '2018-05-12T17:19:06.151Z',
datetimeEmpty: '',
minDatetime: LuxonDateTime.local().minus({ days: 3 }).toISO(),
minDatetime: LuxonDateTime.local().minus({ month: 1, days: 3 }).toISO(),
maxDatetime: LuxonDateTime.local().plus({ days: 3 }).toISO(),
datetimeTheming: LuxonDateTime.local().toISO()
}
Expand Down
4 changes: 2 additions & 2 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export function monthDayIsDisabled (minDate, maxDate, year, month, day) {
}

export function monthIsDisabled (minDate, maxDate, year, month) {
return monthDayIsDisabled(minDate, maxDate, year, month, 1) &&
monthDayIsDisabled(minDate, maxDate, year, month, DateTime.utc(year, month).daysInMonth)
return (minDate && minDate > DateTime.utc(year, month, DateTime.utc(year, month).daysInMonth)) ||
(maxDate && maxDate < DateTime.utc(year, month, 1))
}

export function yearIsDisabled (minDate, maxDate, year) {
Expand Down

0 comments on commit 26493f4

Please sign in to comment.