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

Cannot handle both Date and DateTime #134

Closed
beberlei opened this issue Jun 22, 2012 · 6 comments
Closed

Cannot handle both Date and DateTime #134

beberlei opened this issue Jun 22, 2012 · 6 comments

Comments

@beberlei
Copy link

The DateTime handler only allows for exactly one format. However i need both Date and DateTime serializations.

@calumbrodie
Copy link

I was wondering if it was possible to extend the date time handler or modify the configuration at runtime in order to change the format although I've not spent too much time trying to figure it out.

@stephpy
Copy link

stephpy commented Aug 14, 2012

I have same needs

I guess it could be interesting to allow @Type("DateTime<Y-m-d..........,Timezone>") type.
By default it'll use the handler and timezone format.
But i'm not sure about that ...

@stephpy
Copy link

stephpy commented Aug 16, 2012

mmmh type is not a good option, because @type is used only when we deserialize ...

Let's use an other annotation or something like that, configuring the date time at runtime could be OK, but if you want to serialize datetimes in different format, it'll be not possible

@stephpy
Copy link

stephpy commented Aug 16, 2012

I made an implementation of this on https://github.com/rezzza/JMSSerializerBundle/compare/datetime_annotation

Issue:

  • We have to deal with metadata on GraphNavigator, because the DateTimeHandler has to be aware of metadatas.
  • Handler having options defined via annotations, it's may be not logic.

Thought ? /cc @schmittjoh @beberlei

@schmittjoh
Copy link
Owner

This is now possible by using @Type("DateTime<'Y-m-d', 'UTC'>") for example.

@stephpy
Copy link

stephpy commented Oct 11, 2012

Thanks ;)

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