Defjs
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 valid Date is returned as the same object. A number or string is converted with new Date(value).

  • Output is a Date. A value that produces an invalid date fails with invalid_type.

  • When encoded for the wire, the value becomes an ISO 8601 string (toISOString()).

Edit this page on GitHub
Released under the MIT License. · Copyright © 2026 MunMunMiao