Any plan to make the JsonConfig to support customizing the date format of different Java date types?

hei1233212000@...
 

In the JSON-B 1.0 specification, section 3.5, it supports ALL the native date types of Java like java.util.date, java.time.LocalDate and java.time.LocalTime. HOWEVER, in the JsonConfig, it ONLY provide a single withDateFormat() method (section 4.8) to apply the global custom date format which will make ALL supported date type to use this format.

BUT, there will be a problem if your application use different different date types such as java.util.Date, java.time.LocalDate and java.time.LocalTime. Because when you define the
yyyy-MM-dd
in withDateFormat(), there will be an exception thrown if the object has java.time.LocalTime field.

So, I think it maybe better to allow the client to configure the date format by different date type => e.g:
  • withDateFormat(java.util.Date, dateFormat, Locale)
  • withDateFormat(java.time.LocalDate, dateFormat, Locale)
  • ...
What do you think about it?

Thank you.

Join jsonb-spec@javaee.groups.io to automatically receive all group messages.