Ticket #3191 (closed enhancement: fixed)

Opened 6 years ago

Last modified 5 years ago

NaN causes breakage

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

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

comment:1 Changed 6 years ago by Cloudream

  • Milestone set to TDB

comment:2 Changed 6 years ago by kbwood

  • Status changed from new to closed
  • Resolution set to fixed

Fixed. Incorrect dates now return the default date instead.

comment:3 Changed 5 years ago by rdworth

  • Milestone changed from TBD to 1.6rc1
Note: See TracTickets for help on using tickets.