agent_patch
runs/2026-02-27__21-30-28__gpt-5-3-codex/flux-pr-4680/flux-pr-4680.1-of-1.2026-02-27__21-30-28__gpt-5-3-codex/agent-logs/agent.patch
10042 bytes
diff --git a/tmp/agent-patch-flux-pr-4680.1-of-1.2026-02-27__21-30-28__gpt-5-3-codex/app/packages/docs/content/api.mdx b/app/packages/docs/content/api.mdx
index 47e792c..1dfd0e1 100644
--- a/tmp/agent-patch-flux-pr-4680.1-of-1.2026-02-27__21-30-28__gpt-5-3-codex/app/packages/docs/content/api.mdx
+++ b/app/packages/docs/content/api.mdx
@@ -356,9 +356,11 @@ The `z.iso.datetime()` method enforces ISO 8601; by default, no timezone offsets
const datetime = z.iso.datetime();
datetime.parse("2020-01-01T00:00:00Z"); // ✅
+datetime.parse("2020-01-01T00:00Z"); // ✅
datetime.parse("2020-01-01T00:00:00.123Z"); // ✅
datetime.parse("2020-01-01T00:00:00.123456Z"); // ✅ (arbitrary precision)
datetime.parse("2020-01-01T00:00:00+02:00"); // ❌ (no offsets allowed)
+datetime.parse("2020-01-01T00:00"); // ❌ (no local datetimes by default)
```
To allow timezone offsets:
@@ -366,10 +368,10 @@ To allow timezone offsets:
```ts
const datetime = z.iso.datetime({ offset: true });
-// result is normalized to RFC 3339 format
-datetime.parse("2020-01-01T00:00:00+02"); // ✅ "2020-01-01T00:00:00+02:00"
-datetime.parse("2020-01-01T00:00:00+0200"); // ✅ "2020-01-01T00:00:00+02:00"
-datetime.parse("2020-01-01T00:00:00+02:00"); // ✅ "2020-01-01T00:00:00+02:00"
+datetime.parse("2020-01-01T00:00:00+02"); // ✅
+datetime.parse("2020-01-01T00:00:00+0200"); // ✅
+datetime.parse("2020-01-01T00:00:00+02:00"); // ✅
+datetime.parse("2020-01-01T00:00+02:00"); // ✅
// Z is still supported
datetime.parse("2020-01-01T00:00:00Z"); // ✅
@@ -382,14 +384,18 @@ const schema = z.iso.datetime({ local: true });
schema.parse("2020-01-01T00:00:00"); // ✅
```
-To constrain the allowable `precision` (by default, arbitrary sub-second precision is supported).
+To constrain the allowable `precision` (by default, arbitrary sub-second precision is supported, and seconds are optional):
```ts
-const datetime = z.iso.datetime({ precision: 3 });
+const a = z.iso.datetime({ precision: 3 });
+const b = z.iso.datetime({ precision: -1 });
-datetime.parse("2020-01-01T00:00:00.123Z"); // ✅
-datetime.parse("2020-01-01T00:00:00Z"); // ❌
-datetime.parse("2020-01-01T00:00:00.123456Z"); // ❌
+a.parse("2020-01-01T00:00:00.123Z"); // ✅
+a.parse("2020-01-01T00:00:00Z"); // ❌
+a.parse("2020-01-01T00:00:00.123456Z"); // ❌
+
+b.parse("2020-01-01T00:00Z"); // ✅
+b.parse("2020-01-01T00:00:00Z"); // ❌
```
### ISO dates
@@ -408,13 +414,14 @@ date.parse("2020-01-32"); // ❌
> Added in Zod 3.23
-The `z.iso.time()` method validates strings in the format `HH:MM:SS[.s+]`. The second can include arbitrary decimal precision. It does not allow timezone offsets of any kind.
+The `z.iso.time()` method validates strings in the format `HH:MM` or `HH:MM:SS[.s+]`. It does not allow timezone offsets of any kind.
```ts
const time = z.iso.time();
time.parse("00:00:00"); // ✅
time.parse("09:52:31"); // ✅
+time.parse("09:52"); // ✅
time.parse("23:59:59.9999999"); // ✅ (arbitrary precision)
time.parse("00:00:00.123Z"); // ❌ (no `Z` allowed)
@@ -424,6 +431,9 @@ time.parse("00:00:00.123+02:00"); // ❌ (no offsets allowed)
You can set the `precision` option to constrain the allowable decimal precision.
```ts
+z.iso.time({ precision: -1 }); // HH:MM (minute precision)
+z.iso.time({ precision: 0 }); // HH:MM:SS (second precision)
+z.iso.time({ precision: 3 }); // HH:MM:SS.sss (millisecond precision)
const time = z.iso.time({ precision: 3 });
time.parse("00:00:00.123"); // ✅
@@ -2542,4 +2552,3 @@ const MyFunction = z.function({
const computeTrimmedLength = MyFunction.implement((input) => input.trim.length);
```
-
diff --git a/tmp/agent-patch-flux-pr-4680.1-of-1.2026-02-27__21-30-28__gpt-5-3-codex/app/packages/zod/src/v4/classic/external.ts b/app/packages/zod/src/v4/classic/external.ts
index eccc470..ad83287 100644
--- a/tmp/agent-patch-flux-pr-4680.1-of-1.2026-02-27__21-30-28__gpt-5-3-codex/app/packages/zod/src/v4/classic/external.ts
+++ b/app/packages/zod/src/v4/classic/external.ts
@@ -21,6 +21,7 @@ export {
$input,
$brand,
clone,
+ TimePrecision,
regexes,
treeifyError,
prettifyError,
diff --git a/tmp/agent-patch-flux-pr-4680.1-of-1.2026-02-27__21-30-28__gpt-5-3-codex/app/packages/zod/src/v4/classic/tests/string.test.ts b/app/packages/zod/src/v4/classic/tests/string.test.ts
index 0de8bee..46737d1 100644
--- a/tmp/agent-patch-flux-pr-4680.1-of-1.2026-02-27__21-30-28__gpt-5-3-codex/app/packages/zod/src/v4/classic/tests/string.test.ts
+++ b/app/packages/zod/src/v4/classic/tests/string.test.ts
@@ -760,6 +760,7 @@ test("datetime parsing", () => {
datetime.parse("2022-10-13T09:52:31.8162314Z");
datetime.parse("1970-01-01T00:00:00Z");
datetime.parse("2022-10-13T09:52:31Z");
+ datetime.parse("2022-10-13T09:52Z");
expect(() => datetime.parse("")).toThrow();
expect(() => datetime.parse("foo")).toThrow();
expect(() => datetime.parse("2020-10-14")).toThrow();
@@ -824,8 +825,8 @@ test("datetime offset normalization", () => {
c: a.parse("2020-10-14T17:42:29+02:00"),
}).toMatchInlineSnapshot(`
{
- "a": "2020-10-14T17:42:29+02:00",
- "b": "2020-10-14T17:42:29+02:00",
+ "a": "2020-10-14T17:42:29+02",
+ "b": "2020-10-14T17:42:29+0200",
"c": "2020-10-14T17:42:29+02:00",
}
`);
@@ -887,6 +888,7 @@ test("date parsing", () => {
test("time parsing", () => {
const time = z.string().time();
+ time.parse("00:00");
time.parse("00:00:00");
time.parse("23:00:00");
time.parse("00:59:00");
@@ -918,6 +920,14 @@ test("time parsing", () => {
expect(() => time2.parse("00:00:00.0")).toThrow();
expect(() => time2.parse("00:00:00.000")).toThrow();
expect(() => time2.parse("00:00:00.00+00:00")).toThrow();
+
+ const timeMinute = z.string().time({ precision: -1 });
+ timeMinute.parse("23:59");
+ expect(() => timeMinute.parse("23:59:59")).toThrow();
+
+ const timeSecond = z.string().time({ precision: 0 });
+ timeSecond.parse("23:59:59");
+ expect(() => timeSecond.parse("23:59")).toThrow();
});
test("duration", () => {
diff --git a/tmp/agent-patch-flux-pr-4680.1-of-1.2026-02-27__21-30-28__gpt-5-3-codex/app/packages/zod/src/v4/core/api.ts b/app/packages/zod/src/v4/core/api.ts
index ab6efb7..3ece38b 100644
--- a/tmp/agent-patch-flux-pr-4680.1-of-1.2026-02-27__21-30-28__gpt-5-3-codex/app/packages/zod/src/v4/core/api.ts
+++ b/app/packages/zod/src/v4/core/api.ts
@@ -56,6 +56,14 @@ export type CheckTypeParams<
AlsoOmit extends Exclude<keyof T["_zod"]["def"], "type" | "checks" | "error" | "check"> = never,
> = Params<T, NonNullable<T["_zod"]["isst"] | T["_zod"]["issc"]>, "type" | "checks" | "error" | "check" | AlsoOmit>;
+export const TimePrecision = {
+ Any: null,
+ Minute: -1,
+ Second: 0,
+ Millisecond: 3,
+ Microsecond: 6,
+} as const;
+
// String
export type $ZodStringParams = TypeParams<schemas.$ZodString<string>, "coerce">;
export function _string<T extends schemas.$ZodString>(
diff --git a/tmp/agent-patch-flux-pr-4680.1-of-1.2026-02-27__21-30-28__gpt-5-3-codex/app/packages/zod/src/v4/core/regexes.ts b/app/packages/zod/src/v4/core/regexes.ts
index 9cc1d48..d0f1b6b 100644
--- a/tmp/agent-patch-flux-pr-4680.1-of-1.2026-02-27__21-30-28__gpt-5-3-codex/app/packages/zod/src/v4/core/regexes.ts
+++ b/app/packages/zod/src/v4/core/regexes.ts
@@ -81,15 +81,27 @@ const dateSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][04
export const date: RegExp = /*@__PURE__*/ new RegExp(`^${dateSource}$`);
function timeSource(args: { precision?: number | null }) {
- // let regex = `\\d{2}:\\d{2}:\\d{2}`;
- let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
+ const precision = args.precision;
+ const minutes = `([01]\\d|2[0-3]):[0-5]\\d`;
+ const seconds = `[0-5]\\d`;
- if (args.precision) {
- regex = `${regex}\\.\\d{${args.precision}}`;
- } else if (args.precision == null) {
- regex = `${regex}(\\.\\d+)?`;
+ // HH:MM (minute precision)
+ if (precision === -1) {
+ return minutes;
}
- return regex;
+
+ // HH:MM:SS (second precision)
+ if (precision === 0) {
+ return `${minutes}:${seconds}`;
+ }
+
+ // HH:MM:SS.sss (exact sub-second precision)
+ if (typeof precision === "number" && precision > 0) {
+ return `${minutes}:${seconds}\\.\\d{${precision}}`;
+ }
+
+ // Default: allow minute-only or second+fractional forms.
+ return `${minutes}(:${seconds}(\\.\\d+)?)?`;
}
export function time(args: {
precision?: number | null;
diff --git a/tmp/agent-patch-flux-pr-4680.1-of-1.2026-02-27__21-30-28__gpt-5-3-codex/app/packages/zod/src/v4/core/schemas.ts b/app/packages/zod/src/v4/core/schemas.ts
index e2ace79..0ee0032 100644
--- a/tmp/agent-patch-flux-pr-4680.1-of-1.2026-02-27__21-30-28__gpt-5-3-codex/app/packages/zod/src/v4/core/schemas.ts
+++ b/app/packages/zod/src/v4/core/schemas.ts
@@ -604,20 +604,6 @@ export const $ZodISODateTime: core.$constructor<$ZodISODateTime> = /*@__PURE__*/
(inst, def): void => {
def.pattern ??= regexes.datetime(def);
$ZodStringFormat.init(inst, def);
-
- const _super = inst._zod.check;
- inst._zod.check = (payload) => {
- _super(payload);
-
- // normalize timezone offset
- // add colon & minutes if missing
- // if no offset, return early
- const curr = payload.value;
- if (/[+-]\d\d$/.test(curr)) payload.value = curr + ":00";
- else if (/[+-]\d\d\d\d$/.test(curr)) {
- payload.value = curr.slice(0, -2) + ":" + curr.slice(-2);
- }
- };
}
);
diff --git a/tmp/agent-patch-flux-pr-4680.1-of-1.2026-02-27__21-30-28__gpt-5-3-codex/app/packages/zod/src/v4/mini/external.ts b/app/packages/zod/src/v4/mini/external.ts
index 4b23cf4..c0ee75f 100644
--- a/tmp/agent-patch-flux-pr-4680.1-of-1.2026-02-27__21-30-28__gpt-5-3-codex/app/packages/zod/src/v4/mini/external.ts
+++ b/app/packages/zod/src/v4/mini/external.ts
@@ -13,6 +13,7 @@ export {
$brand,
function,
clone,
+ TimePrecision,
regexes,
treeifyError,
prettifyError,