Skip to content

Document that a stored timerange bound of 24:00:00 fails to load #108

Closed

Description

@CaffeinatedCoder

docs/efcore.md#timerange-and-the-custom-timerange-type says that TimeOnly has no 24:00:00 and tells the writer what to use instead. It doesn't say what happens to a row that already holds one — written by SQL, a migration script, or another application — and that case fails loudly on read, with an exception that doesn't name the column or the value.

Measured on main (7f4dc47) against PostgreSQL 17.11, with CREATE TYPE timerange AS RANGE (subtype = time) and a row inserted as '[22:00,24:00)'::timerange:

db.Rows.Single(x => x.Id == 1)                      // ArgumentOutOfRangeException: Ticks must be between 0 and and TimeOnly.MaxValue.Ticks. (Parameter 'ticks')
db.Rows.Where(...).Select(x => x.Hours.UpperBound()) // the same exception

The exception comes from Npgsql's time → TimeOnly read, so the library can't change it. It can say so: a sentence under "Good to know" that a stored 24:00:00 bound throws ArgumentOutOfRangeException when the row loads (or when UpperBound() is projected), and that the options are to store (22:00,) or [22:00,23:59:59.999999] instead, or to fix the data with UPDATE … SET hours = timerange(lower(hours), NULL).

Not a wrong answer and not a library defect — a documentation gap found in the 10.0.0 bug hunt.

Activity

  1. added
    documentation
    area/ranges
    package/efcore
    severity/low
    on Oct 17, 2026
  2. added this to the 10.0.0 milestone 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/rangesdocumentationpackage/efcoreseverity/low

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions