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

fix pythonCollectionFromPropertyList fails on converting dates prior to year 1970 #596

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ZigZagT
Copy link

@ZigZagT ZigZagT commented Feb 29, 2024

Fixes a issue where pythonCollectionFromPropertyList crashes on dates prior to year 1970.

Both NSDate and python's datetime classes are capable of handling dates prior to 1970/01/01. However, the datetime.fromtimestamp API does not. It would throw the following exception:

  File "/opt/homebrew/lib/python3.11/site-packages/PyObjCTools/Conversion.py", line 220, in pythonCollectionFromPropertyList
    return datetime.datetime.fromtimestamp(aCollection.timeIntervalSince1970())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: year 0 is out of range

@ZigZagT
Copy link
Author

ZigZagT commented Feb 29, 2024

pre-commit is not working

black....................................................................

(timeout after 180 seconds)

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.

None yet

1 participant