-
-
Notifications
You must be signed in to change notification settings - Fork 509
Added support for dates with milliseconds #1063
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
Conversation
* @param mixed $value \DateTime|\MongoDate|int|float | ||
* @return \DateTime | ||
*/ | ||
public static function getDateTime($value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DateTime conversion is getting too heavy to nice fit in the "closures" and there would be too much code duplication otherwise, hence the public static function. I am open to alternatives.
The Travis issues are related to truncation, I would need to address them. |
I decided to remove tests for truncation because Mongo is not consistent across its version. I could have enforce the truncation in PHP, but it would significantly slow the process and I don’t think it’s worth it, microseconds should not matter to end user anyway since Mongo doesn’t support it. |
Travis errors now unrelated, good to merge. |
Added support for dates with milliseconds
Are you Jesus? |
Fixes #1061
Affects #1060 : now will overflow and the loaded date will be in 2036. Note that problem only appears when saving to and loading from Mongo, not when simply converting values.
Duplicate of #1028 (sorry, didn’t see).
Microseconds passed as MongoDate, DateTime, float or DateTime string (
'2000-01-01 00:00:00.123'
) are all handled.