#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
Milestone: | → TDB |
---|
comment:2 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 Changed 15 years ago by
Milestone: | TBD → 1.6rc1 |
---|
Fixed. Incorrect dates now return the default date instead.