fn
normalizeDate
testeddemoCoerce a DateLike into a Date. null/undefined become the
current time; a non-UTC string is parsed leniently so partial dates such as
'2024-3' are accepted.
Demo
Loading demo…
Signature
ts
export function normalizeDate(date: DateLike): Date{ ... }Parameters
| Parameter | Type | Description |
|---|---|---|
date | DateLike | The value to coerce |
Returns
DateA Date instance (possibly Invalid Date)