Skip to main content Skip to docs navigation

Errors

On this page

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.

unexpectedOption (code: 1)

An error indicating that a key in the options object is invalid.

unexpectedOptions (code: 1)

An error indicating that one more keys in the options object is invalid.

unexpectedOptionValue (code: 2)

An error when an option is provide an unsupported value. For example a value of 'cheese' for toolbarPlacement which only supports 'top', 'bottom', 'default'.

typeMismatch (code: 3)

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.

numbersOutOfRage (code: 4)

An error when an option value is outside of the expected range. For example restrictions.daysOfWeekDisabled excepts a value between 0 and 6.

failedToParseDate (code: 5)

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.

mustProvideElement (code: 6)

An error when an element to attach to was not provided in the constructor.

subscribeMismatch (code: 7)

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])

conflictingConfiguration (code: 8)

The configuration has conflicting rules e.g. minDate is after maxDate

dateString

Logs a warning if a date option value is provided as a string, instead of a date/datetime object.

Error Messages

failedToSetInvalidDate

Used with an Error Event type if the user selects a date that fails restriction validation.

failedToParseInput

Used with an Error Event type when a user changes the value of the input field directly, and does not provide a valid date.