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 broken conversion of microseconds less than 100000. #1382

Merged
merged 1 commit into from
Mar 9, 2016

Conversation

jpinner-lyft
Copy link
Contributor

Dates with microsecond values less than 100000 are not correctly converted to PHP objects.

When converting from MongoDate objects, the usec field returns an integer that is concatenated directly to a string formated date in craftDateTime. For example, the value 1.0001 gets split into 1 second and 100 microseconds, which then gets concatenated as "1.100".

When converting numeric values, the sub-seconds are broken into a string which is then padded to six values; however, it is casted to an int first. For example, 1.0001 gets split into a string "0001" which is cast to the integer 1 and padded to "100000", resulting in "1.100000".

In order to properly convert microseconds, they are string padded without converting to an integer.

@alcaeus alcaeus added the Bug label Mar 9, 2016
@alcaeus alcaeus added this to the 1.0.6 milestone Mar 9, 2016
alcaeus added a commit that referenced this pull request Mar 9, 2016
Fix broken conversion of microseconds less than 100000.
@alcaeus alcaeus merged commit bccb028 into doctrine:1.0.x Mar 9, 2016
@alcaeus
Copy link
Member

alcaeus commented Mar 9, 2016

Thanks!

@jpinner-lyft jpinner-lyft deleted the bugfix-date-time-microseconds-1.0.x branch March 9, 2016 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants