Skip to content

Commit

Permalink
clarify datetime ISO 8601 (#2673)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanstanley authored Aug 23, 2023
1 parent 9bd3879 commit f59be09
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ z.string().regex(regex);
z.string().includes(string);
z.string().startsWith(string);
z.string().endsWith(string);
z.string().datetime(); // defaults to UTC, see below for options
z.string().datetime(); // ISO 8601; default is without UTC offset, see below for options
z.string().ip(); // defaults to IPv4 and IPv6, see below for options

// transformations
Expand Down Expand Up @@ -760,7 +760,7 @@ z.string().ip({ message: "Invalid IP address" });

### ISO datetimes

The `z.string().datetime()` method defaults to UTC validation: no timezone offsets with arbitrary sub-second decimal precision.
The `z.string().datetime()` method enforces ISO 8601; default is no timezone offsets and arbitrary sub-second decimal precision.

```ts
const datetime = z.string().datetime();
Expand Down

0 comments on commit f59be09

Please sign in to comment.