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

DateTime ISO8601 in PHP doesnt support milliseconds #395

Closed
farconada opened this issue Jun 24, 2014 · 3 comments
Closed

DateTime ISO8601 in PHP doesnt support milliseconds #395

farconada opened this issue Jun 24, 2014 · 3 comments

Comments

@farconada
Copy link

dates from javascript code doesnt as in:

dat = new Date();
dat.toISOString();
"2014-06-24T16:49:51.439Z"

has fractions of seconds.
PHP doesnt support fractions of seconds https://bugs.php.net/bug.php?id=51950
Drupal has a workaround https://api.drupal.org/api/drupal/core%21vendor%21zendframework%21zend-stdlib%21Zend%21Stdlib%21DateTime.php/function/DateTime%3A%3AcreateFromISO8601/8
You could workaround this in jms config with

jms_serializer:
handlers:
datetime:
default_format: "Y-m-d\TH:i:s.uO" # ISO8601
default_timezone: "UTC"

but it should be better coded in the bundle with a patch like the Drupal one

@stof
Copy link
Contributor

stof commented Jun 25, 2014

given that the format is configurable in the handler, it cannot be implemented the Drupal way (Drupal can do it because ISO8601 is hardcoded in the code)

@pculka
Copy link

pculka commented Oct 17, 2016

has this actually been fixed with PHP7?
https://3v4l.org/ADn0l

@goetas
Copy link
Collaborator

goetas commented Apr 3, 2017

@goetas goetas closed this as completed Apr 3, 2017
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

No branches or pull requests

4 participants