Android Joda Time crash on Android

185 views Asked by At

I see from stack traces next crash:

java.lang.IllegalArgumentException: Invalid format: "2017-08-29T00:00:00-0700" is malformed at "T00:00:00-0700"

Here is the code that does the conversion (it is not exactly the code since it is JSON parsing):

  private final DateTimeFormatter parser = ISODateTimeFormat
    .dateOptionalTimeParser()
    .withChronology(ISOChronology.getInstance())
    .withZoneUTC();

  DateTime dt = parser.parseDateTime(dateString);

I've tried to reproduce it in a test on JVM, and it doesn't crash. I also sought to reproduce it on emulator and also it ran without exception.

Am I right that it is particular devices/versions error? Or I just made a mistake in code that reproducing the issue.

Is string from exception valid ISO date formatted string?

0

There are 0 answers