Skip to main content

Search and Top Navigation

#3191 closed enhancement (fixed)

Opened August 15, 2008 07:56PM UTC

Closed August 21, 2008 04:18PM UTC

Last modified November 19, 2008 04:30AM UTC

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:

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.

Attachments (0)
Change History (3)

Changed August 16, 2008 09:14PM UTC by Cloudream comment:1

milestone: → TDB

Changed August 21, 2008 04:18PM UTC by kbwood comment:2

resolution: → fixed
status: newclosed

Fixed. Incorrect dates now return the default date instead.

Changed November 19, 2008 04:30AM UTC by rdworth comment:3

milestone: TBD1.6rc1