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 <
ivanjunc...@gmail.com> 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 <daniels...@apache.org>
> 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 <
> > ivanjunc...@gmail.com> 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