julman99 / gson-fire

A java library that adds some very useful features to Gson, like Date serializing to unix timestamp or RFC3339, method (getters) serialization, pre/post processors and many others. Check out the documentation to learn how to use it!
http://gsonfire.io
Other
229 stars 37 forks source link

Add tests and change parser to allow .2 in addition to .200 #41

Closed helio-pires closed 6 years ago

helio-pires commented 6 years ago

Why

The parser allow an input string like "2013-02-07T02:29:08.2Z" but it formats it like "2013-02-07T02:29:08.002Z".

What

Change the parser to have the wanted millis values when it's missing the right 0. I'm adding more tests, for the different position of a 0 and the omission of the ones in the right.

How to test

To test the fix, run tests "test2millisFraction" and "test22millisFraction"