Skip to content

Comments

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

Open
ZigZagT wants to merge 1 commit intoronaldoussoren:mainfrom
ZigZagT:master
Open

fix pythonCollectionFromPropertyList fails on converting dates prior to year 1970#596
ZigZagT wants to merge 1 commit intoronaldoussoren:mainfrom
ZigZagT:master

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.

1 participant