Repository navigation
Description
Motivation
time_datetime_parse_iso8601() currently accepts only whole-second UTC timestamps or timestamps with exactly nine fractional digits. The implementation requires an input length of either 20 or 30, so otherwise valid UTC inputs with millisecond or microsecond precision are outside the supported subset.
Extend this existing API without changing the formatter or the supported timezone syntax.
Code reference: std/time/format.wave — time_datetime_parse_iso8601.
Scope
Accept YYYY-MM-DDTHH:MM:SSZ and YYYY-MM-DDTHH:MM:SS.<fraction>Z, where <fraction> contains one to nine ASCII decimal digits. Right-pad the fractional value with zeros to obtain nanoseconds; do not round or truncate excess digits.
Examples:
| Input | Nanoseconds |
|---|---|
2026-09-20T12:34:56Z |
0 |
2026-09-20T12:34:56.1Z |
100000000 |
2026-09-20T12:34:56.123Z |
123000000 |
2026-09-20T12:34:56.123456Z |
123456000 |
2026-09-20T12:34:56.123456789Z |
123456789 |
Keep the DateTimeResult API and existing calendar/time validation. The formatter must continue producing its fixed nine-digit representation, and TIME_FORMAT_ISO8601_LENGTH must remain unchanged.
Completion criteria
- Accept every fractional length from one through nine and preserve whole-second parsing.
- Normalize fractional values exactly, including leading zeros, trailing zeros, and an all-zero fraction.
- Reject a decimal point with no digits, more than nine digits, non-digit fractional characters, missing or misplaced
Z, and trailing input. - Validate the complete input shape before indexing it; short or malformed input returns the existing failure result rather than panicking.
- Preserve rejection of invalid dates and times through
time_datetime_from_parts. - Add runnable standard-library regressions under
tests/cases/, including all supported lengths and parse-format-parse round trips. - Update the parser's API comment to describe the expanded subset.
Timezone offsets, lowercase separators, leap-second support, and general RFC 3339 expansion are outside this issue.
Activity