Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): DateTimeFormat mishandles some combinations of settings on Android 8 #11874

Merged
merged 4 commits into from
Aug 7, 2020
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,10 @@ public void handleCreationDict(KrollDict properties)

// Have Android generate a localized date/time pattern string from above skeleton pattern.
// This will inject needed separators and auto-swap components like month/day according to locale.
// Note: Android 8 sometimes inserts invalid pattern char 'b' for AM/PM. Should be 'a' instead.
String datePattern = android.text.format.DateFormat.getBestDateTimePattern(
locale, stringBuilder.toString());
datePattern = datePattern.replace('b', 'a');
this.dateFormat = new SimpleDateFormat(datePattern, locale);
} catch (Exception ex) {
Log.e(TAG, "Failed to generate 'best' date pattern.", ex);
Expand Down