Skip to content

InstantRange and InstantSet read offsets beyond ±15:59:59 that timestamptz rejects #188

Closed

Description

@CaffeinatedCoder

InstantRange, its multirange, InstantSet and InstantSet<T> read an offset beyond ±15:59:59, which PostgreSQL's timestamptz input rejects. NodaTime's Offset reaches ±18:00, and NodaPatterns.ParseInstant takes whatever the o<G> pattern reads. Measured on main (bab799b) against PostgreSQL 16 and 18, which agree:

InstantRange.Parse("[2026-01-01 10:00:00+16:00,)", null);   // [2025-12-31T18:00:00Z,)
InstantSet.Parse("{\"2026-01-01 10:00:00+18:00\"}", null);  // {2025-12-31T16:00:00Z}
SELECT pg_input_is_valid('2026-01-01 10:00:00+15:59:59', 'timestamptz'),  -- t
       pg_input_is_valid('2026-01-01 10:00:00+16:00', 'timestamptz'),     -- f
       pg_input_is_valid('2026-01-01 10:00:00-16', 'timestamptz');        -- f

The library reads a value from text the server rejects. That breaks the literal rule ("both refuse, or the same value"), but it can't change a stored value: the library writes its own literal at offset zero.

Found while measuring #131's offset grammar. LiteralCorpusProbeTests family offset beyond range (added with the #130/#131 fix) catches it: with the cap removed, 8 rows fail (InstantRange, RangeSet<InstantRange>, InstantSet, InstantSet<T>, and LocalDateTime once it takes offsets). The fix caps the offset at ±15:59:59 in NodaPatterns, in the same PR as #130/#131.

Activity

  1. added this to the 10.0.0 milestone on Oct 18, 2026
  2. added
    bug
    found-by/oracle
    package/nodatime
    area/literals
    severity/low
    on Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/literalsbugfound-by/oraclepackage/nodatimeseverity/low

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions