File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
src/main/java/com/force/i18n Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -363,11 +363,14 @@ Locale overrideDateLocale(Locale aLocale) {
363363 * The MALAYSIA (MY) (ms_MY) locale returns a time format of the form 'hh:mm' making it impossible to differentiate AM/PM
364364 * @return a dateformat with either a 24-hour clock or the necessary AM/PM identifier attached
365365 */
366- private static DateFormat checkAM (DateFormat dateFormat , Locale l ) {
367- DateFormat df = dateFormat ;
368- String p = ((SimpleDateFormat )dateFormat ).toPattern ();
369- if ((p .indexOf ('a' ) == -1 ) && (p .indexOf ('k' ) == -1 ) && (p .indexOf ('H' ) == -1 )) {
370- df = new SimpleDateFormat (p + " a" , l );
366+ DateFormat checkAM (DateFormat dateFormat , Locale l ) {
367+ SimpleDateFormat df = (SimpleDateFormat )dateFormat ;
368+ String p = df .toPattern ();
369+
370+ // fix if neither 'H' or 'k' (24-hour) does not present, and if 'a' or 'B'
371+ // (AM/PM notation) doesn't exist. ICU version of SimpleDateFormat may return 'B' for zh-TW
372+ if ((p .indexOf ('H' ) == -1 && p .indexOf ('k' ) == -1 ) && (p .indexOf ('a' ) == -1 && p .indexOf ('B' ) == -1 )) {
373+ df .applyPattern (p + " a" );
371374 }
372375 return df ;
373376 }
You can’t perform that action at this time.
0 commit comments