-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
Datetime created from negative float timestamp is not monotonic (fraction part is added instead of substracted) #7758
Comments
For the explanation: fractional timestamps are currently not supported when parsing, which means PHP handles inputs like |
this is how it is parsed currently probably, however if unix timestamp is negative, the fractional part must be decremented as if the whole TS was a standard floating point number https://3v4l.org/rKOAb shows the fractional part cannot be even used alone (eg. parsed with |
I think it's fair to say that this a feature request as the docs do state that only whole numbers are supported. |
Description
The following code:
https://3v4l.org/EWpSj
Diff of current output vs expected:
PHP Version
present since PHP 8.0, should be fixed starting this version
it seems the issue is present only when TS is parsed,
getTimestamp
/format('u')
seems correct across all PHP versions - https://3v4l.org/CjJLfThe text was updated successfully, but these errors were encountered: