Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Remove date limits imposed by Python's datetime module to support BC and far-future dates #26

Copy link
Copy link
@jmurty

Description

@jmurty
Issue body actions

We currently rely on Python's built-in datetime module – and its datetime and date constructs – to represent and return date/time information, but this module only supports dates between 1 and 9999 AD. The in-built Python libraries for handling date/times are simply not designed or intended for representing dates in the distant past such as any BC dates, or dates in the far future.

Currently we ignore "extreme" dates that cannot be handled by datetime by bounding recognised dates to the datetime.MINYEAR (1) and datetime.MAXYEAR (9999) boundary constants.

We will update the date parsing and processing in python-edtf to avoid this limitation by removing any use of the datetime module which imposes the limits, and will use Python's much more flexible struct_time representation when returning values that were previously returned as date or datetime objects.

While this change will make it more awkward to work with some of the API, it will allow us to better represent the real data (rather than bounding the supported date ranges) and should be relatively easy for users to convert into richer Python objects like datetimes when possible (1 AD <= year <= 9999 AD) or something like astropy.time for dates outside datetime's supported range.

WARNING: This change will cause a breaking API change for the following methods of EDTF classes which will return struct_time constructs instead of date or datetime objects:

  • lower_strict()
  • upper_strict()
  • lower_fuzzy()
  • upper_fuzzy()
  • or indeed any features that rely on the underlying _strict_date() methods

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.