Opened 13 years ago

Closed 13 years ago

#1856 closed defect (fixed)

DatePicker month select problems

Reported by: guest Owned by: bill
Priority: high Milestone:
Component: Widgets Version: 0.4
Keywords: Cc:
Blocked By: Blocking:

Description

If you viewing October 2006 (fig 1), then scroll back one week (fig 2), then click on the a date in November, the DatePicker? jumps to October - this is because the current previous / current / next cannot handle the next next month (from September jumping to November. Can't think of a simple fix for this - adding a nextNext flag would work - but feels messy. The whole previous / current / next flag system seems a bit inadequate - I think it would be simpler just to mark the shown dates with an offset to the current month (-1 / 0 / +1 / +2). Could just have a utility method to work out the monthly difference between two dates (this would avoid problems such as that reported in bug 1855 (ie spot the problem with the following line var curClass = (nextDate.getMonth()<this.curMonth.getMonth())?'previous':(nextDate.getMonth()==this.curMonth.getMonth())?'current':'next';

Haven't got time to fix this myself. Better get back on with the day job.

Cool ASCII art follows...

fig 1.

October

S M T W T F S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 etc

fig 2.

September

S M T W T F S 24 25 26 27 28 29 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 1 2 3 4

Change History (1)

comment:1 Changed 13 years ago by Karl Tiedt

Resolution: fixed
Status: newclosed

(In [6881]) Fixes #1855 and fixes #1856, Datepicker now appends a djDateValue attribute to the calendar nodes so that it can track dates without using a formula. previous/current/next attributes are now determined by the following forumula: var curClass = (nextDate.getMonth() != this.curMonth.getMonth() && Number(nextDate) < Number(this.curMonth))?'previous':(nextDate.getMonth()==this.curMonth.getMonth())?'current':'next';

Basically if the months dont equal, and nextDate is less than curDate its the previous month, otherwise if they are equal its the current month, and if neither, then its the next month.

Note: See TracTickets for help on using tickets.