Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8a196065 authored by Elliott Hughes's avatar Elliott Hughes Committed by Android Git Automerger
Browse files

am 82461951: Merge "DateUtils should use the user\'s 12/24-hour preference, not the locale\'s."

* commit '82461951':
  DateUtils should use the user's 12/24-hour preference, not the locale's.
parents 5adfb21e 82461951
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -816,6 +816,12 @@ public class DateUtils
     */
    public static Formatter formatDateRange(Context context, Formatter formatter, long startMillis,
                                            long endMillis, int flags, String timeZone) {
        // icu4c will fall back to the locale's preferred 12/24 format,
        // but we want to fall back to the user's preference.
        if ((flags & (FORMAT_12HOUR | FORMAT_24HOUR)) == 0) {
            flags |= DateFormat.is24HourFormat(context) ? FORMAT_24HOUR : FORMAT_12HOUR;
        }

        String range = DateIntervalFormat.formatDateRange(startMillis, endMillis, flags, timeZone);
        try {
            formatter.out().append(range);