You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When first day of week is changed in Android 14 settings (https://developer.android.com/about/versions/14/features#regional-preferences), value of WeekFields.of(Locale.getDefault()).getFirstDayOfWeek() does not match that of Calendar.getInstance().getFirstDayOfWeek() or java.time.temporal.WeekFields.of(Locale.getDefault()).getFirstDayOfWeek():
This what various APIs return when default first day of week is monday, and it's changed to sunday in system settings:
first day of week org.threeten.bp.temporal = MONDAY
first day of week java.time.temporal.WeekFields = SUNDAY
first day of week java.util.Calendar = 1
first day of week androidx.core.text.utilLocalePreferences = sun
As you can see only threetenbp returns incorrect value.
The text was updated successfully, but these errors were encountered:
It looks like Android uses the BCP 47 'U' extension to override the first day of week in the locale specifier. For example, configuring Wednesday as the first day of week in the Android regional settings in an otherwise en-us environment yields a en_US_#u-fw-wed locale specifier.
When such a locale is used with WeekFields.of(Locale) the u-fw-wed extension is removed before WeekFields resolves the first-day-of-week through the java.util.Calendar API. I'm not sure why this happens. Perhaps @jodastephen can shed some light on why the 'eliminate variants' step is present?
If the variant elimination is removed and the original locale object is passed to Calendar.getInstance(), the correct fdow is used by WeekFields.
When first day of week is changed in Android 14 settings (https://developer.android.com/about/versions/14/features#regional-preferences), value of
WeekFields.of(Locale.getDefault()).getFirstDayOfWeek()
does not match that ofCalendar.getInstance().getFirstDayOfWeek()
orjava.time.temporal.WeekFields.of(Locale.getDefault()).getFirstDayOfWeek()
:This what various APIs return when default first day of week is monday, and it's changed to sunday in system settings:
As you can see only threetenbp returns incorrect value.
The text was updated successfully, but these errors were encountered: