Function Updated 17 Oct 2026
isDate(value)
Checks if the value is a date, or text that can be read as one. Recognized text formats are ISO formats such as 2023-01-01, 2023-01-01T13:45 and 2023-01-01T13:45:00Z (optionally with a time zone offset). Text such as 20230101 or 01.01.2023 is not a date.
Parameters
valueobjectrequiredValue 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
Normal JavaScript, 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!");The JavaScript above produces this output:
Text is a date!