Repository navigation
fix: read the offsets PostgreSQL's timestamp input reads, and no others - #189
Merged
Merged
Conversation
Three gaps in the temporal offset grammar, measured on PostgreSQL 16 and 18 (which agree): - DateTime and DateTimeOffset stopped at ±14:00, where DateTimeOffset does, while timestamp and timestamptz read up to ±15:59:59 (#131). IsoTemporal now takes hours up to 15; a DateTimeOffset offset it cannot hold (beyond ±14:00, or with seconds) is the instant at offset zero, as the seconds offset already was. - LocalDateTime refused Z and an offset, which timestamp input and DateTimeRange drop (#130). NodaPatterns now reads them and keeps the wall clock. - Instant took NodaTime's ±18:00, so +16:00, which timestamptz refuses, parsed (#188). Capped at ±15:59:59 for Instant and LocalDateTime alike. The ISO forms only: +0530, +1 and a space before Z stay refused (J07). TemporalLiteralGrammarTests and NodaTimeParseFormatTests hold the measured rows (24 fail with the fix reverted); two rows that pinned +15:00 as invalid now pin +16. LiteralCorpusProbeTests gains the offset edges; its #130/#131 candidates are removed as fixed, and with the Instant cap removed it fails 8 rows of the new 'offset beyond range' family. Closes #130 Closes #131 Closes #188 Found-By: OT Defect-Class: LIT Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # CHANGELOG.md # test/oracles/candidates.json # test/oracles/claims.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #130
Closes #131
Closes #188
Problem
The temporal offset grammar disagreed with PostgreSQL's
timestampandtimestamptzinput in three places. PostgreSQL 16 and 18 agree on all of them.DateTimeOffsetbounds and elements threw on an offset beyond ±14:00, whichtimestamptzreads up to ±15:59:59. The same limit applied toDateTime, soDateTimeRangethrew on[2026-01-01 10:00:00+15:00,)whiletimestampreads it; noted on the issue.LocalDateTimeRange, its multirange andLocalDateTimeSetthrew on aZor an offset.timestampinput drops it, and so doesDateTimeRange.InstantRangeandInstantSetread+16:00through+18:00(NodaTime'sOffsetrange), whichtimestamptzrejects.Change
IsoTemporal(core): offset hours up to 15 (MaxOffsetHours). ADateTimeOffsetoffset it can't hold, beyond ±14:00 or with seconds, is read as the instant at offset zero. That was already the rule for the seconds offset;TryParseSecondsOffsetbecameTryParseWideOffset.DateTimekeeps the wall clock as before.NodaPatterns(NodaTime):LocalDateTimefalls back to the offset patterns and keeps.LocalDateTime, which drops the offset.InstantandLocalDateTimeboth reject an offset of ±16:00 or more.+0530,+1,ZandUTC, which PostgreSQL also reads, still fail, asdocs/serialization.mddocuments (J07). The corpus counts them as documented rejections.docs/serialization.md#dates-and-times-are-strict-iso-8601(claims J40 and J41; J39 is taken by fix: read PostgreSQL 16's 0x/0o/0b integers and digit separators #184). Two CHANGELOG entries under 10.0.0 → Fixed.Tests
::timestampand::timestamptzon PostgreSQL 16 and 18:TemporalLiteralGrammarTestscoversDateTimeup to±15:59:59andDateTimeOffsetbeyond ±14:00 as the UTC instant.NodaTimeParseFormatTestscoversLocalDateTimewithZand offsets, and rejects±16and+18. With both source files reverted, 24 rows fail. Two old rows asserted that+15:00is invalid, which PostgreSQL contradicts; they now assert that+16fails.LiteralCorpusProbeTests(live PostgreSQL 17) has new offset edges for timestamp and timestamptz in every range, multirange and set:offset range,offset beyond range,malformed offset, moreoffsetrows and two non-ISO rows. Its LocalDateTime bounds and elements refuse Z and an offset that tsrange and DateTimeRange read #130 and DateTimeOffset bounds and elements refuse offsets beyond ±14:00 that timestamptz reads #131 candidates now report "candidate fixed" and are removed. With only the Instant cap reverted, 8 rows fail with "library reads, PostgreSQL refuses", which is InstantRange and InstantSet read offsets beyond ±15:59:59 that timestamptz rejects #188.🤖 Generated with Claude Code