diff --git a/src/DatetimeYearPicker.vue b/src/DatetimeYearPicker.vue index 7174bde..43ee1ea 100644 --- a/src/DatetimeYearPicker.vue +++ b/src/DatetimeYearPicker.vue @@ -1,10 +1,8 @@ @@ -41,7 +39,10 @@ export default { methods: { select (year) { - if (year.disabled) return + if (year.disabled) { + return + } + this.$emit('change', parseInt(year.number)) }, diff --git a/src/util.js b/src/util.js index 3c03978..a129e6f 100644 --- a/src/util.js +++ b/src/util.js @@ -41,10 +41,11 @@ export function monthDayIsDisabled (minDate, maxDate, year, month, day) { } export function yearIsDisabled (minDate, maxDate, year) { - minDate = minDate ? minDate.year : null - maxDate = maxDate ? maxDate.year : null - return (minDate && year < minDate) || - (maxDate && year > maxDate) + const minYear = minDate ? minDate.year : null + const maxYear = maxDate ? maxDate.year : null + + return (minYear && year < minYear) || + (maxYear && year > maxYear) } export function timeComponentIsDisabled (min, max, component) {