Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#3191 closed enhancement (fixed)

NaN causes breakage

Reported by: sorpigal Owned by: grabanski
Priority: minor Milestone: 1.6rc1
Component: ui.datepicker Version: 1.5.2
Keywords: Cc:
Blocked by: Blocking:

Description

A bug in my options builder code resulted in defaultDate being set to NaN. Don't ask, not important. The result of this was the datepicker showing the prev/next header, the month/year dropdowns and the day of week labels, but no grid of days. After fixing my code I decided that this is probably a bug in the datepicker, too, and that a NaN default date should be treated like a null default date. I replaced the final statement in _determineDate with this:

return (isNaN(date) ? defaultDate :

(date == null ? defaultDate : (typeof date == 'string' ? offsetString(date, this._getDaysInMonth) :

(typeof date == 'number' ? offsetNumeric(date) : date))));

Which does what I want. You could argue also that this is not a bug and the developer should not make the mistake. If so, perhaps some kind of error should be thrown to indicate that this value will not work. Allowing it to silently break is not good.

Change History (3)

comment:1 Changed 15 years ago by Cloudream

Milestone: TDB

comment:2 Changed 15 years ago by kbwood

Resolution: fixed
Status: newclosed

Fixed. Incorrect dates now return the default date instead.

comment:3 Changed 15 years ago by rdworth

Milestone: TBD1.6rc1
Note: See TracTickets for help on using tickets.