The date picker will throw errors for a number of different reason. Most errors are related to an invalid setup.
Except where noted, the thrown errors are a type of TdError
that extends the base javascript Error
class.
Where indicated the error provides a code value so that a developer can check for this value.
An error indicating that one more keys in the options object is invalid.
An error when an option is provide an unsupported value. For example a value of 'cheese' for toolbarPlacement which only supports 'top', 'bottom', 'default'.
An error when an option value is the wrong type. For example a string value was provided to multipleDates which only supports true or false.
An error when an option value is outside of the expected range.
For example restrictions.daysOfWeekDisabled
excepts a value between 0 and 6.
An error when a value for a date options couldn't be parsed. Either the option was an invalid string or an invalid Date object.
An error when an element to attach to was not provided in the constructor.
An error if providing an array for the events to subscribe method doesn't have the same number of callbacks. E.g., subscribe([1,2], [1])
The configuration has conflicting rules e.g. minDate is after maxDate
Logs a warning if a date option value is provided as a string, instead of a date/datetime object.
Used with an Error Event type if the user selects a date that fails restriction validation.
Used with an Error Event type when a user changes the value of the input field directly, and does not provide a valid date.