Skip to content

Commit 317e29e

Browse files
committed
Fix for year selector as an input type number
Making sure calendar doesn't get redrawn when an onchange event gets triggered on the year selector and the calendar has already been updated by the previous oninput event
1 parent cd5bf42 commit 317e29e

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/dateinput/dateinput.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,10 @@
421421

422422
// year selector
423423
yearSelector.unbind("change").change(function() {
424-
self.setValue($(this).val(), monthSelector.val());
424+
var year = $(this).val();
425+
if (year != '' + currYear) {
426+
self.setValue($(this).val(), monthSelector.val());
427+
}
425428
});
426429

427430
if (yearSelector.is('input')) {
@@ -483,7 +486,6 @@
483486
},
484487
//}}}
485488

486-
487489
//{{{ setValue
488490

489491
setValue: function(year, month, day) {
@@ -512,9 +514,7 @@
512514
select(date, conf);
513515
return self;
514516
}
515-
516-
var redrawWeeks = (month != currMonth) || (year != currYear) || ($('a', weeks).length == 0);
517-
517+
518518
currMonth = month;
519519
currYear = year;
520520
currDay = day;
@@ -563,8 +563,6 @@
563563
}
564564

565565
// populate weeks
566-
if (!redrawWeeks) { return self; }
567-
568566
weeks.empty();
569567
pm.add(nm).removeClass(css.disabled);
570568

0 commit comments

Comments
 (0)