I tried Dani, but the conversion only works in the client side. The server
side returns a format like this "2019-03-14T14:08:09.389". If I add the
configs proposed from Romain in his article it starts returning
yyyyMMddHHmmssZ.

I am still investigating to see if I find the issue. Another possibility is
to make the default date converter configurable through a property and if
the property was not set it will use yyyyMMddHHmmssZ. I proposed this in
the johnzon list, let's see what happens.

On Tue, Mar 12, 2019 at 4:45 PM Daniel Cunha <[email protected]> wrote:

> Hi Ivan,
>
> for sure you need to know the data format that you are expecting, by
> default Apache Johnzon uses the pattern “yyyyMMddHHmmssZ”
> You can use the JAXB converter to do it, as Romain describe here in his
> blog:
>
> https://rmannibucau.wordpress.com/2015/07/09/javaee-apache-johnzon-json-library-javascript-date/
>
> Em ter, 12 de mar de 2019 às 15:18, Ivan Junckes Filho <
> [email protected]> escreveu:
>
> > I know Dani, that is the issue. But how to fix it? It should have been
> > converting to the right format.
> >
> > On Tue, Mar 12, 2019 at 2:51 PM Daniel Cunha <[email protected]>
> > wrote:
> >
> > > Well.. seems that you convert expect that: dd/MM/yyyy HH:mm:ss
> > > (
> > >
> > >
> >
> https://github.com/ivanjunckes/convertertest/blob/master/src/main/java/com/test/DateTimeConverter.java#L17
> > > )
> > > But you are receiving that: 2019-03-12T17:14:31.941
> > >
> > > Em ter, 12 de mar de 2019 às 14:19, Ivan Junckes Filho <
> > > [email protected]> escreveu:
> > >
> > > > Hey guys, can anyone help me to understand why I am having issues
> with
> > > the
> > > > DateTimeConverter in my test?
> > > >
> > > > Here is a sample project with the issue.
> > > > https://github.com/ivanjunckes/convertertest
> > > >
> > > > If anyone could also help make this project work without the need for
> > the
> > > > DateTimeConverter but actually using a configuration properties would
> > be
> > > > great.
> > > >
> > > > *Error:*
> > > > Caused by: java.lang.IllegalArgumentException:
> > java.text.ParseException:
> > > > Unparseable date: "2019-03-12T17:14:31.941"
> > > > at com.test.DateTimeConverter.fromString(DateTimeConverter.java:32)
> > > > at com.test.DateTimeConverter.fromString(DateTimeConverter.java:10)
> > > > at org.apache.johnzon.mapper.internal.ConverterAdapter.to
> > > > (ConverterAdapter.java:37)
> > > > at org.apache.johnzon.mapper.internal.ConverterAdapter.to
> > > > (ConverterAdapter.java:24)
> > > > at
> > > >
> > > >
> > >
> >
> org.apache.johnzon.mapper.MappingParserImpl.toValue(MappingParserImpl.java:742)
> > > > ... 141 more
> > > > Caused by: java.text.ParseException: Unparseable date:
> > > > "2019-03-12T17:14:31.941"
> > > > at java.text.DateFormat.parse(DateFormat.java:366)
> > > > at com.test.DateTimeConverter.fromString(DateTimeConverter.java:30)
> > > > ... 145 more
> > > >
> > >
> > >
> > > --
> > > Daniel "soro" Cunha
> > > https://twitter.com/dvlc_
> > >
> >
>
>
> --
> Daniel "soro" Cunha
> https://twitter.com/dvlc_
>

Reply via email to