Opened 15 years ago

Last modified 15 years ago

#1855 closed defect

DatePicker year rollover bug — at Version 1

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

Description (last modified by alex)

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 (1)

comment:1 Changed 15 years ago by alex

Description: modified (diff)
Milestone: 0.5
Owner: changed from anonymous to tk
Note: See TracTickets for help on using tickets.