Skip to main content

Basic Usage

Type Signature

string | $ZodDateParams
Optional error message (string) or configuration object

Behavior

z.date() only accepts JavaScript Date objects. It does NOT accept:
  • Timestamps (numbers)
  • Date strings
  • Other date representations

Validation Methods

.min()

Enforces a minimum date/time.
number | Date
required
Minimum date (as Date object or timestamp)
string | $ZodCheckGreaterThanParams
Custom error message

.max()

Enforces a maximum date/time.
number | Date
required
Maximum date (as Date object or timestamp)
string | $ZodCheckLessThanParams
Custom error message

Properties

.minDate (Deprecated)

Returns the minimum date constraint as a Date object, or null if not set.
This property is deprecated. Check constraints directly in your code instead.

.maxDate (Deprecated)

Returns the maximum date constraint as a Date object, or null if not set.
This property is deprecated. Check constraints directly in your code instead.

Common Use Cases

Date Range Validation

Future Dates Only

Past Dates Only

Birth Date Validation

Type Coercion

To accept date strings or timestamps and convert them to Date objects:

Preprocessing

For custom date parsing logic:

ISO Date Strings

For validating ISO 8601 date strings, use the ISO schemas:

Refinements

For complex date logic:

Chaining

TypeScript Type

See Also