I have a piece of code like this on my java side:
private static DateFormat getHourFormatter(){
//DateFormatSymbols dateFormatSymbols = new DateFormatSymbols(_locale);
Locale locale = Locale.FRENCH; //locale : "fr"
DateFormat hourFormatter = new SimpleDateFormat( "hh:mm a",locale); //hourFormatter: simpleDateFormat@103068 locale: "fr"
hourFormatter.setTimeZone( TimeZone.getTimeZone("GMT") );
return hourFormatter; //hourFormatter: SimpleDateFormat@103068
}
protected static boolean isHoursTimeStringValid( String hourDisplay ) {
try {
getHourFormatter().parse( hourDisplay ); //hourDisplay: "01:01 Matin"
return true;
} catch (ParseException e) { //e: "java.text.ParseException: Upparseable date "01:01 Matin"
return false;
}
}
It is working fine for English locale if I change the locale value to US.
But for French locale it throwing parsing error.
java.text.ParseException: Upparseable date "01:01 Matin"
I have added the debug info as commented line for better understanding