/date/toDates
stdConverts the given array of values into Dates using the Date constructor.
Type signature
(xs: (string | number | Date)[]) => Date[]
Examples
toDates([
"2019-01-15T13:54:33.232Z",
new Date(
"2019-01-15T13:54:33.232Z",
).valueOf(),
new Date(
"2019-01-15T13:54:33.232Z",
),
]);
// ⇒ [new Date("2019-01-15T13:54:33.232Z"), new Date("2019-01-15T13:54:33.232Z"), new Date("2019-01-15T13:54:33.232Z")]
Try in REPL
Questions
- How to convert an array of string and timestamps into an array of Date objects?