Core
struct.date
Struct that accepts a Date, timestamp, or date string and outputs a Date.
@defjs/core · Function
Signature
function date(): Struct<Date | number | string, Date>;
-
Accepts a
Date, a millisecond timestamp, or a string. A validDateis returned as the same object. A number or string is converted withnew Date(value). -
Output is a
Date. A value that produces an invalid date fails withinvalid_type. -
When encoded for the wire, the value becomes an ISO 8601 string (
toISOString()).