Opened 15 years ago

Last modified 15 years ago

#1855 closed defect

DatePicker year rollover bug — at Initial Version

Reported by: guest Owned by: anonymous
Priority: high Milestone: 0.9
Component: General Version: 0.4
Keywords: Cc:
Blocked By: Blocking:


From the _initUI method of DatePicker?.js

Clicking on date in January whilst viewing month of December causes DatePicker? to jump back to November

The following line clearly doesn't handle the case of nextDate being in January (month = 0) and curMonth being December (month == 11)

var curClass = (nextDate.getMonth()<this.curMonth.getMonth())?'previous':(nextDate.getMonth()==this.curMonth.getMonth())?'current':'next';

Fix is to replace above line with the following

var myMonth = nextDate.getMonth(); var curMonth = this.curMonth.getMonth(); var curClass = (myMonth==curMonth)?'current':(myMonth==0 && curMonth==11)?'next':(myMonth<curMonth)?'previous':'next';

Change History (0)

Note: See TracTickets for help on using tickets.