Skip to content

fix: read the offsets PostgreSQL's timestamp input reads, and no others - #189

Merged
CaffeinatedCoder merged 2 commits into
mainfrom
fix/temporal-offset-grammar
Oct 18, 2026
Merged

CaffeinatedCoder merged 2 commits into
mainfrom
fix/temporal-offset-grammar

Conversation

@CaffeinatedCoder

Copy link
Copy Markdown
Owner

Closes #130
Closes #131
Closes #188

Problem

The temporal offset grammar disagreed with PostgreSQL's timestamp and timestamptz input in three places. PostgreSQL 16 and 18 agree on all of them.

Change

  • IsoTemporal (core): offset hours up to 15 (MaxOffsetHours). A DateTimeOffset offset 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; TryParseSecondsOffset became TryParseWideOffset. DateTime keeps the wall clock as before.
  • NodaPatterns (NodaTime): LocalDateTime falls back to the offset patterns and keeps .LocalDateTime, which drops the offset. Instant and LocalDateTime both reject an offset of ±16:00 or more.
  • Only the ISO forms are added. +0530, +1, Z and UTC, which PostgreSQL also reads, still fail, as docs/serialization.md documents (J07). The corpus counts them as documented rejections.
  • Docs: one bullet and one sentence in 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

🤖 Generated with Claude Code

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]>
@CaffeinatedCoder CaffeinatedCoder added this to the 10.0.0 milestone Oct 18, 2026
@CaffeinatedCoder CaffeinatedCoder added bug Something isn't working found-by/oracle Found by the generated-oracle machinery (claims × API surfaces) package/nodatime Affects CodoMetis.ValueRanges.NodaTime area/literals Parse, TryParse and formatting package/core Affects CodoMetis.ValueRanges severity/low Cosmetic, message or documentation-level difference labels Oct 18, 2026
# Conflicts:
#	CHANGELOG.md
#	test/oracles/candidates.json
#	test/oracles/claims.json
@CaffeinatedCoder
CaffeinatedCoder merged commit 5fb273a into main Oct 18, 2026
@CaffeinatedCoder
CaffeinatedCoder deleted the fix/temporal-offset-grammar branch October 18, 2026 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/literals Parse, TryParse and formatting bug Something isn't working found-by/oracle Found by the generated-oracle machinery (claims × API surfaces) package/core Affects CodoMetis.ValueRanges package/nodatime Affects CodoMetis.ValueRanges.NodaTime severity/low Cosmetic, message or documentation-level difference

Projects

None yet

1 participant