diff --git a/example/index.html b/example/index.html index 4967301..727a8c1 100644 --- a/example/index.html +++ b/example/index.html @@ -24,8 +24,8 @@

date-time-picker examples

var datePicker = new DateTimePicker.Date({ lang: 'zh-CN', default: date.value, - min: '2015-08-10', - max: '2017-11-20' + min: '2018-01-01', + max: '2025-12-31' }) datePicker.on('selected', function (formatDate, now) { console.log('selected date: ', formatDate, now) diff --git a/src/panel/days.js b/src/panel/days.js index 6cfa02a..33bfb22 100644 --- a/src/panel/days.js +++ b/src/panel/days.js @@ -231,11 +231,12 @@ function checkInrange (parsedCurrent, parsedMin, parsedMax) { } function checkDisabled (date, parsedCurrent, parsedMin, parsedMax) { + var disabled = false if (parsedCurrent.year === parsedMin.year && parsedCurrent.month === parsedMin.month) { - return date < parsedMin.date + disabled = date < parsedMin.date } - if (parsedCurrent.year === parsedMax.year && parsedCurrent.month === parsedMax.month) { - return date > parsedMax.date + if (!disabled && parsedCurrent.year === parsedMax.year && parsedCurrent.month === parsedMax.month) { + disabled = date > parsedMax.date } - return false + return disabled }