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 deserialization does not work properly. #400

Closed
sukhrobkhakimov opened this issue Jul 11, 2014 · 2 comments
Closed

DateTime deserialization does not work properly. #400

sukhrobkhakimov opened this issue Jul 11, 2014 · 2 comments

Comments

@sukhrobkhakimov
Copy link

This works:

<property name="dateOfBirth" type="DateTime" serialized-name="dateOfBirth" />

This doesn't work:

<property name="dateOfBirth" type="DateTime<'Y-m-d\TH:i:sO'>" serialized-name="dateOfBirth" />

Even though these two statements are equal, the second one is not working. Weird!
Error: [FATAL] StartTag: invalid element name

@sukhrobkhakimov
Copy link
Author

There is another issue. Even though I use the first one (the working one) and provide an invalid format like this:

{
    "dateOfBirth": "2013-07-21"
}

This is resulting 500 Internal Server Error. But, I expect it to be null if the format is invalid and show a friendly validation error to a user.

@sukhrobkhakimov
Copy link
Author

It seems I have to use an alternative format when using these "<" or ">" characters. Like this:

<property name="dateOfBirth">
    <type><![CDATA[DateTime<'Y-m-d\TH:i:sO'>]]></type>
</property>

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

1 participant