Catalin Morosan
Catalin Morosan

Reputation: 7937

Joda time bug on certain Android devices?

I'm using joda-time 1.6.2 in an Android app and I am getting some crash reports

java.lang.IllegalArgumentException: Invalid format: "8:00 AM" is malformed at "AM"

And the code that triggers is is the following:

DateTimeFormatter formatter = DateTimeFormat.forPattern("hh:mm a");
LocalTime lt = formatter.parseDateTime(value).toLocalTime();

I can't reproduce this crash on my phones so it happens only on certain Android devices and I have no clue why.

Upvotes: 3

Views: 416

Answers (1)

magnarwium
magnarwium

Reputation: 235

I was faced with the same issue after the release of Android 5. Only devices running this version would crash.

This is probably a localization issue. It appears that your default local does not know the "AM"-string, but something else.

See my post for details and my solution

Upvotes: 2

Related Questions