Skip to content

Ranges starting on 0001-01-01 seem to not be valid #65

Description

@ecmwf-cobarzan

Ranges starting on 0001-01-01 seem to not be valid, even though otherwise working:

>>> from datetimerange import DateTimeRange
>>> s = "0001-01-01"
>>> e = "2026-01-10"
>>> r = DateTimeRange(s,e)
>>> r
0001-01-01T00:00:00 - 2026-01-10T00:00:00
>>> r.start_datetime
datetime.datetime(1, 1, 1, 0, 0)
>>> r.end_datetime
datetime.datetime(2026, 1, 10, 0, 0)
>>> r.is_valid_timerange()
False

The same works as expected for 0001-01-02 though (i.e. the interval is valid).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions