Skip to content

Commit 10cc994

Browse files
committed
4.1.1
1 parent 028b289 commit 10cc994

File tree

4 files changed

+3
-47
lines changed

4 files changed

+3
-47
lines changed

packages/zod/jsr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zod/zod",
3-
"version": "4.1.0",
3+
"version": "4.1.1",
44
"exports": {
55
"./package.json": "./package.json",
66
".": "./src/index.ts",

packages/zod/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zod",
3-
"version": "4.1.0",
3+
"version": "4.1.1",
44
"type": "module",
55
"license": "MIT",
66
"author": "Colin McDonnell <zod@colinhacks.com>",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const version = {
22
major: 4,
33
minor: 1,
4-
patch: 0 as number,
4+
patch: 1 as number,
55
} as const;

play.ts

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,3 @@
11
import * as z from "zod";
22

33
z;
4-
5-
const stringToDate = z.codec(
6-
z.iso.datetime(), // input schema: ISO date string
7-
z.date(), // output schema: Date object
8-
{
9-
decode: (isoString) => new Date(isoString), // ISO string → Date
10-
encode: (date) => date.toISOString(), // Date → ISO string
11-
}
12-
);
13-
14-
stringToDate.decode("2024-01-15T10:30:00.000Z");
15-
// => Date
16-
17-
stringToDate.encode(new Date())
18-
// => string
19-
20-
21-
stringToDate.decode(1234);
22-
// ^ Argument of type 'number' is not assignable
23-
// to parameter of type 'string'.ts(2345)
24-
25-
stringToDate.encode(1234);
26-
// ^ Argument of type 'number' is not assignable
27-
// to parameter of type 'Date'.ts(2345)
28-
29-
30-
31-
including:
32-
33-
stringToNumber
34-
stringToInt
35-
stringToBigInt
36-
numberToBigInt
37-
isoDatetimeToDate
38-
epochSecondsToDate
39-
epochMillisToDate
40-
jsonCodec
41-
utf8ToBytes
42-
bytesToUtf8
43-
base64ToBytes
44-
base64urlToBytes
45-
hexToBytes
46-
stringToURL
47-
uriComponent

0 commit comments

Comments
 (0)