isValid

Commons
stable

Returns true when the given value can be coerced into a valid JavaScript Date (not NaN). Accepts any input type.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

date
requis
any
The value to test. Can be a Date object, a date string, a timestamp number, or any other value.

API

Valeur de retour

La valeur retournée par cet util.

true when the value produces a valid Date (not NaN), false otherwise.

Usage

Exemples

Extraits de code prêts à coller.

Valid and invalid date inputs

typescript