Skip to main content

date

$date

Normalize the input value as a Date. Accepts strings, numbers, Date instances, and date-field objects produced by $date-object.

  • 'now' — returns the current timestamp
  • '+1h', '-30m', etc. — relative offsets from now
  • ISO strings and numeric epoch values are parsed automatically
  • {year, month, day, ...zone} — reassembled from a $date-object output

Output type is inferred from the schema's type option:

  • 'string' → ISO string
  • 'number' → epoch milliseconds
  • otherwise → Date instance

See $is-date for strict Date validation.