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

i18n-ize the DateTimeHandler using IntlDateFormatter #147

Closed
nlaplante opened this issue Jul 9, 2012 · 4 comments
Closed

i18n-ize the DateTimeHandler using IntlDateFormatter #147

nlaplante opened this issue Jul 9, 2012 · 4 comments

Comments

@nlaplante
Copy link

It would be very nice if the serialization process would output dates and times formatted according to the configured application locale using PHP's IntlDateFormatter class (or datefmt_ family of functions).

I'm trying to use the javascript library DateJS in its french locale but it cannot parse the date strings generated by the JMSSerializerBundle on DateTime fields.

@calumbrodie
Copy link

This may be relevant. #153 #153

@nlaplante
Copy link
Author

Indeed it is. Do you think formatting according to locale should be done on the client side or it would be better to have it handled server-side while having access to PHP's and Symfony,s builtin i18n functionality?

@schmittjoh
Copy link
Owner

You can register your own handler for datetime objects which converts them to the desired format.

In the latest version, you can also configure the format via @Type("DateTime<'format'>").

@nlaplante
Copy link
Author

Thanks I'll have a look at this!

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

3 participants