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

@JsonFormat is ignored by the DateSerializer unless either a custom pattern or a timezone are specified #1109

Closed
aseovic opened this issue Jan 30, 2016 · 1 comment
Milestone

Comments

@aseovic
Copy link
Contributor

aseovic commented Jan 30, 2016

If the user simply specifies @JsonFormat annotation with string shape, the shape is ignored and the date is serialized as long:

static class Person
{
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    public Date dateOfBirth;
}

gets serialized as:

{"dateOfBirth":1198800000000}

I believe the correct behavior should be to write the date as a string in ISO8601 format.

If you agree I will implement the fix and create a PR for it.

@cowtowncoder
Copy link
Member

@aseovic yes that looks like a bug, PR would be great.

@cowtowncoder cowtowncoder modified the milestones: 1.9.13, 2.7.1 Feb 1, 2016
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

2 participants