Added workaround for long time format

master
M66B 5 days ago
parent 1d2f63ec49
commit 6c9a836f15

@ -2416,8 +2416,7 @@ public class Helper {
}
static DateFormat getTimeInstance(Context context, int style) {
if (context != null &&
(style == SimpleDateFormat.SHORT || style == SimpleDateFormat.MEDIUM))
if (context != null)
return new SimpleDateFormat(getTimePattern(context, style));
else
return SimpleDateFormat.getTimeInstance(style);
@ -2436,8 +2435,7 @@ public class Helper {
}
static DateFormat getDateTimeInstance(Context context, int dateStyle, int timeStyle) {
if (context != null &&
(timeStyle == SimpleDateFormat.SHORT || timeStyle == SimpleDateFormat.MEDIUM)) {
if (context != null) {
DateFormat dateFormat = getDateInstance(context, dateStyle);
if (dateFormat instanceof SimpleDateFormat) {
String datePattern = ((SimpleDateFormat) dateFormat).toPattern();
@ -2455,6 +2453,8 @@ public class Helper {
String skeleton = (is24Hour ? "Hm" : "hm");
if (style == SimpleDateFormat.MEDIUM)
skeleton += "s";
else if (style == SimpleDateFormat.LONG)
skeleton += "sz";
return android.text.format.DateFormat.getBestDateTimePattern(Locale.getDefault(), skeleton);
}

Loading…
Cancel
Save