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
JavaScript negative timestamp are not supported #1600
Comments
Happy to accept a PR to fix this. I guess we should:
|
I don't get this :
For the rest, everything is running fine and ready for PR |
I think it might be fine, I just meant: make sure passing timestamps like |
Yes, it runs fine with these timestamps. The generated |
Best to submit a PR and we can discuss from there. |
Bug
When parsing a JavaScript positive timestamp (number of milliseconds since EPOCH), pydantic parses it properly. However, for a negative JavaScript timestamp (before 1st January 1970), a
date value out of range
error is thrown.Version
Output of
python -c "import pydantic.utils; print(pydantic.utils.version_info())"
:Code example
The following code raises the describe error (while it would correctly work with
{ "jsTimestamp": 1118102400000 }
).Possible solution
A solution would be to update the
from_unix_seconds
function in datetime_parse.py to compareseconds
withMS_WATERSHED
as absolute value.The text was updated successfully, but these errors were encountered: