isDate(value) Last updated: 30. May 2026

Checks if value is a date type.

See also: isDateTime isString assert

Parameters

Name Type Description
value object

Value to check if it is, or can be converted to, a date.

Returns

True if the value is or can be converted to a date.

Example

Code example (JS)

JS is normal JavaScript either running in the browser or on the Docly™ server.
let text = "2023-01-01"; // a date
let text2 = "20230101"; // not a date

if (docly.isDate(text)) write("Text is a date!");
if (docly.isDate(text2)) write("Text2 is a date!");

Output

The JS code above produces the output shown below:
Text is a date!