Closed Bug 1370859 Opened 2 years ago Closed 6 months ago

<input type="date"> datepicker doesn't follow system "First day of week"


(Core :: DOM: Core & HTML, defect, P3)




Tracking Status
firefox67 --- fixed


(Reporter: jeroen.pulles, Assigned: mkmelin)


(Blocks 1 open bug)



(1 file, 2 obsolete files)

The datepicker widget starts the week on Sunday, but the Language & Region settings panel on my Mac has "First day of week" set to "Monday".

Also, why render Saturday and Sunday in red? Why differentiate between "work days" and "weekend", and more importantly, why use a signalling color such as red here? 

Firefox Nightly, Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:55.0) Gecko/20100101 Firefox/55.0
Priority: -- → P3
The picker follows app's locale, not system locale.

See bug 1366134 for details on when we look into OS regional preferences for date patterns.

> Also, why render Saturday and Sunday in red? Why differentiate between "work days" and "weekend"

Most cultures differentiate weekend days. See CLDR's

Actually, this is still wrong even though I set intl.regional_prefs.use_os_locales true.
It's always using the Sunday as first day of week.

Assignee: nobody → mkmelin+mozilla
OS: macOS → All
Attached patch bug1370859_datepicker_week.patch (obsolete) — Splinter Review
Attachment #9043828 - Flags: review?(gandalf)
Ever confirmed: true
Comment on attachment 9043828 [details] [diff] [review]

Review of attachment 9043828 [details] [diff] [review]:

::: toolkit/modules/DateTimePickerPanel.jsm
@@ +12,5 @@
>  var DateTimePickerPanel = class {
>    constructor(element) {
>      this.element = element;
> +    this.locales = element.ownerDocument.defaultView.getRegionalPrefsLocales();

No need to cache this. Just call it from the `initPicker`. LocaleService is caching and invalidating cache on locale changes. We don't want to duplicate it here.
Attached patch bug1370859_datepicker_week.patch (obsolete) — Splinter Review
Attachment #9043828 - Attachment is obsolete: true
Attachment #9043828 - Flags: review?(gandalf)
Attachment #9045171 - Flags: review?(gandalf)
Comment on attachment 9045171 [details] [diff] [review]

Review of attachment 9045171 [details] [diff] [review]:

::: toolkit/modules/DateTimePickerPanel.jsm
@@ +98,5 @@
>    initPicker(detail) {
>      // TODO: When bug 1376616 lands, replace this.setGregorian with
>      //       mozIntl.Locale for setting calendar to Gregorian
> +    const locales = this.element.ownerDocument.defaultView.getRegionalPrefsLocales();

what's the reason of not using `Services.locale.regionalPrefsLocales` here? If there's a strong reason, maybe add a comment?
Attachment #9045171 - Flags: review?(gandalf) → review+
Pushed by
for <input type="date"> respect intl.regional_prefs.use_os_locales when selecting "First day of week". r=gandalf
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla67

This may be "fixed" in terms of Mozilla believing their code is correct, but the issue itself is not fixed. People want to be able to change the first day of the week; Mozilla does not let them. I have Monday set as the first day of the week in my OS, I have intl.regional_prefs.use_os_locales set to true, OS locale set to Australia, app locale as UK because it's the closest, yet still the date picker puts Sunday first. This religious hangover has no relevance to many people; ISO 8601 deems Monday to be the first day of the week. I don't understand the insistence on perpetuating this outdated format.

@Roy - can you provide the output of your about:support section for Intl&L10n?

Internationalisation & Localisation
Application Settings  
Requested Locales ["en-GB"]
Available Locales ["en-GB","en-US"]
App Locales ["en-GB","en-US"]
Regional Preferences ["en-AU"]
Default Locale "en-GB"
Operating System  
System Locales ["en-GB"]
Regional Preferences ["en-AU"]

Seems like Gecko accurately picks your regional preferences locale as en-AU.

The source of your problem is that CLDR picks Sunday as the first day of the week for region AU [0] and Gecko platform nor products have API/UI to manually set regional preferences such as this.

I'm open to extend Gecko to support such overrides (hour cycle, first day, maybe several basic date/time styles), but it's a major project and I won't have time to work on that.

If you're interested, file a bug and I'll mentor you.


Yes and no. The real source of the issue is that CLDR is treated as canonical over retrieving the setting via GetLocaleInfoEx on Windows, locale -k LC_TIME on Linux, etc.

Ah, that's a good point!

We even have infra for that [0]! We currently take firstDay straight from CLDR [1], but for some items like date/time patterns and hourcycle, we allow OSPreferences to provide an OS-specific overlay.

We could add OSPreferences::GetFirstDayOfTheWeek which would return -1-6 where -1` means "no override" and then take it from CLDR, otherwise use the OS info.


You need to log in before you can comment on or make changes to this bug.