JAX-RS: date fields are incorrectly marshalled
Today I have found that, by default, Glassfish 4 JAX-RS handles POJO
to JSON conversion very unfortunately, here is an example result:
2013-08-19T08:00:00.000 (not timezone means UTC)
The date above was created like this:
Calendar c = new GregorianCalendar();
//calendar uses my current, CEST, timezone
When I print this, I get:
2013, August 19, 08:00:00 CEST
which is equivalent of:
2013, August, 19, 06:00:00 UTC
So, in CEST we have 8am, while it is 6am UTC.
Now, Glassfish, using MOXy is generating:
var date = new Date(dateField);
2013, August, 19, 10:00:00 CEST.
So, instead of 8am we have 10am.
I think this is a major bug, it causes all the applications, by
default, to produce invalid dates.
I have asked my colleague from different project, they use GF4 as
well, he said they do not have that issue. When we double checked, we
discovered a major bug in that application, they just were not aware
Can anyone else confirm this is a bug? IS there any workaround? Should
it be reported to MOXy or Glassfish? I cannot tell where the problem