Skip to content

LocalDateRange's day-before-max infinity rule is untested, and a minimum end counts as infinity #257

Closed

Description

@CaffeinatedCoder

Problem

LocalDateRange's "day before the maximum stands for infinity" rule (#224, PR #238) has no test. Seeding end >= LocalDate.MaxIsoValue.PlusDays(-1) → end >= LocalDate.MaxIsoValue in LocalDateRange.EndIsInfinity passes every suite: unit, NodaTime, conventions, EF, EF-Noda and the full live integration suite. The live NodaTime test uses an inclusive infinity] literal. The same seed on DateRange is caught. Found by the final pre-release analysis on add665c (pass A).

Also in the same function (DateRange.cs:502, LocalDateRange.cs:568): an upper end at the minimum date counts as infinity. DateRange [0001-01-01,0001-01-01].Shift(5) and LocalDateRange [MinIso,MinIso].Shift(5) come back unchanged. In PostgreSQL that range is [-infinity,0001-01-02), whose upper bound is finite. A closed end's exclusive form is the day after it, so the end == MinValue arm is wrong.

Change

Drop the minimum from the end-is-infinity test (an end is infinite only at the day before the maximum, or the maximum, per the read rule), and pin both sides per infinity-backed type.

Done when

LocalDateRange.CreateFinite(x, LocalDate.MaxIsoValue.PlusDays(-1)).Shift(Period.FromDays(-1)) keeps its end. [Min,Min].Shift(5) moves for DateRange and LocalDateRange. Both fail with the respective seed.

Activity

  1. added this to the 10.0.0 milestone on Oct 19, 2026
  2. added
    bug
    silent
    area/ranges
    package/nodatime
    package/core
    severity/low
    on Oct 19, 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/rangesbugpackage/corepackage/nodatimeseverity/lowsilent

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions