diff --git a/examples/dialog-modal/js/datepicker.js b/examples/dialog-modal/js/datepicker.js index 30236fab49..9411c12220 100644 --- a/examples/dialog-modal/js/datepicker.js +++ b/examples/dialog-modal/js/datepicker.js @@ -121,7 +121,9 @@ DatePicker.prototype.updateGrid = function () { var daysInMonth = new Date(fd.getFullYear(), fd.getMonth() + 1, 0).getDate(); var dayOfWeek = firstDayOfMonth.getDay(); - var d = new Date(firstDayOfMonth - dayOfWeek); + firstDayOfMonth.setDate(firstDayOfMonth.getDate() - dayOfWeek); + + var d = new Date(firstDayOfMonth); for (i = 0; i < this.days.length; i++) { flag = d.getMonth() != fd.getMonth(); @@ -134,9 +136,12 @@ DatePicker.prototype.updateGrid = function () { d.setDate(d.getDate() + 1); } - if (dayOfWeek + daysInMonth < 35) { + if ((dayOfWeek + daysInMonth) < 36) { this.hideLastRow(); } + else { + this.showLastRow(); + } };