Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fallback on error in datetime() before year 1970 #193

Merged
merged 1 commit into from
Apr 2, 2024

Conversation

Lenqth
Copy link
Contributor

@Lenqth Lenqth commented Apr 19, 2021

Describe the bug

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Anaconda\python3\envs\***\lib\site-packages\maya\core.py", line 250, in datetime
    dt = Datetime.utcfromtimestamp(self._epoch)
OSError: [Errno 22] Invalid argument

when MayaDT.datatime() (calls utcfromtimestamp) with negative epoch MayaDT object.

Environment and Version

  • OS (incl. terminal and shell used): Powershell with Microsoft Windows 10 Home 10.0.19042
  • Python Version: 3.7.9
  • maya Version: 0.6.1
  • Your timezone: Japan Time (+09:00)

To Reproduce
( note that occured on Windows environment , but maybe not on Linux environment )

import maya
maya.when("1949-01-01").datetime()

Expected behavior

>>> import maya
>>> maya.when("1949-01-01").datetime()
datetime.datetime(1949, 1, 1, 0, 0, tzinfo=<UTC>)

@kennethreitz kennethreitz merged commit 722eb25 into kennethreitz:master Apr 2, 2024
@kennethreitz
Copy link
Owner

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants