arrow-py / arrow

🏹 Better dates & times for Python
https://arrow.readthedocs.io
Apache License 2.0
8.71k stars 673 forks source link

Support for handling dates in BC #945

Closed majorisgit closed 3 years ago

majorisgit commented 3 years ago

Feature Request

Thank you for the wonderful library and your efforts. Please add support for handling dates before 0AD, in BC.

import arrow

arrow.get(2013, 5, 5) <Arrow [2013-05-05T00:00:00+00:00]> arrow.get(-5000, 5, 5) Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.7/dist-packages/arrow/api.py", line 80, in get return _factory.get(*args, *kwargs) File "/usr/local/lib/python3.7/dist-packages/arrow/factory.py", line 308, in get return self.type(args, **kwargs) File "/usr/local/lib/python3.7/dist-packages/arrow/arrow.py", line 175, in init year, month, day, hour, minute, second, microsecond, tzinfo, fold=fold ValueError: year -5000 is out of range

systemcatch commented 3 years ago

Hey @majorisgit this is not something we would be able to support, Python's datetime module has min/max year values of 1/9999 and we depend heavily upon it.

You may have better luck using the calendar module but be warned old dates can be difficult to work with.

https://stackoverflow.com/questions/1310740/what-is-the-oldest-time-that-can-be-represented-in-python