Skip to content

Commit fa12f25

Browse files
okuryuJonathan Mak
authored and
Jonathan Mak
committed
Fix a issue with cloudn't select a date when passing minimumDate
This issue happen in select any dates by selectDates() method when passing minimumDate configuration. Fix yui#1030.
1 parent 503efd8 commit fa12f25

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/calendar/js/calendar-base.js

+1
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ Y.CalendarBase = Y.extend( CalendarBase, Y.Widget, {
409409
* @private
410410
*/
411411
_addDateToSelection : function (oDate, index) {
412+
oDate.setHours(12);
412413

413414
if (this._canBeSelected(oDate)) {
414415

src/calendar/tests/unit/assets/calendar-tests.js

+14
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,20 @@ YUI.add('calendar-tests', function(Y) {
225225

226226
},
227227

228+
testMinDatesSelection : function () {
229+
var cfg = {
230+
contentBox: "#firstcontainer",
231+
date: new Date(2011,11,5),
232+
minimumDate: new Date(2011,11,5)
233+
};
234+
235+
this.firstcalendar = new Y.Calendar(cfg);
236+
this.firstcalendar.render();
237+
this.firstcalendar.selectDates(new Date(2011,11,5));
238+
239+
Y.Assert.isTrue(this.firstcalendar._dateToNode(new Date(2011,11,5)).hasClass("yui3-calendar-day-selected"));
240+
},
241+
228242
testRules : function () {
229243
var myRules = {
230244
"2011": "fullyear",

0 commit comments

Comments
 (0)