Bug 218511 - Date picker does not support regional formats
Summary: Date picker does not support regional formats
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: Safari Technology Preview
Hardware: Mac macOS 10.15
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-11-03 06:08 PST by Jeroen Bensch
Modified: 2022-02-14 12:12 PST (History)
5 users (show)

See Also:


Attachments
Date Picker Region (311.74 KB, image/png)
2020-11-03 13:05 PST, Aditya Keerthi
no flags Details
Showing mismatching regional format vs date picker presentation. (342.32 KB, image/png)
2020-11-03 13:13 PST, Jeroen Bensch
no flags Details
Dutch (Belgium) date format (416.22 KB, image/png)
2020-11-04 23:24 PST, Jeroen Bensch
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeroen Bensch 2020-11-03 06:08:30 PST
Safari Technology Preview has a date picker but it does not take into account the user's region.

In the US they use MM/DD/YYYY but others use DD/MM/YYYY, depending on their region's date format.

Nomatter the region, the date picker always shows the format MM/DD/YYYY.
Comment 1 Radar WebKit Bug Importer 2020-11-03 12:52:56 PST
<rdar://problem/71007120>
Comment 2 Aditya Keerthi 2020-11-03 13:05:44 PST
Created attachment 413096 [details]
Date Picker Region
Comment 3 Aditya Keerthi 2020-11-03 13:08:16 PST
Hi Jeroen! Thank you for the report.

The date picker should honor the user's region, based on the value in System Preferences > Language & Region.

I've attached a screenshot of the date picker in the Canadian region, which follows the format YYYY-MM-DD (as displayed at the bottom of the System Preferences panel).

Would you mind sharing the region for which you are seeing a mismatch?
Comment 4 Jeroen Bensch 2020-11-03 13:13:10 PST
Created attachment 413101 [details]
Showing mismatching regional format vs date picker presentation.
Comment 5 Jeroen Bensch 2020-11-03 13:16:10 PST
Hey Aditya,

I've added the screenshot. Belgium has DD/MM/YYYY as common date format (Even though I'm a YYYY-MM-DD afficionado myself)

It's interesting to see it do a YYYY-MM-DD well, and not DD/MM/YYYY, I'll switch and see if it does Canada correctly here.
Comment 6 Jeroen Bensch 2020-11-03 13:19:42 PST
OK,

So even when setting the region to Canada with YYYY-MM-DD as format, then closing and opening Safari (Release 115 (Safari 14.1, WebKit 15611.1.3.5)) it still shows MM/DD/YYYY... Strange.
Comment 7 Aditya Keerthi 2020-11-04 19:46:03 PST
(In reply to Jeroen Bensch from comment #6)
> OK,
> 
> So even when setting the region to Canada with YYYY-MM-DD as format, then
> closing and opening Safari (Release 115 (Safari 14.1, WebKit 15611.1.3.5))
> it still shows MM/DD/YYYY... Strange.

Hi Jeroen, thank you for sharing the screenshot and trying out more locales.

Unfortunately, I'm still unable to reproduce, and I'm also seeing that other users are able to see a picker which matches their locale (example: https://twitter.com/_nb/status/1323567444082921472)

In order to try to reproduce, I have a couple of follow-up questions:

1. I noticed your screenshot has "(Custom)" in the region. Do you know why that is the case? Are you also seeing "(Custom)" when trying out the Canadian locale?

2. To the left of the region, there is a list of preferred languages. Would you mind sharing the values in that list?
Comment 8 Jeroen Bensch 2020-11-04 23:23:16 PST
Thanks for following up, and not just discarding the bug.

As per your quetions:

1) It shows (Custom) because I don't use the Belgian region's thousands and decimal separators. I use a comma for thousands and a dot for decimals, like in the US. So it has nothing to do with the date. Also when following the region's decimal notation it does not affect the date format shown in the date picker.

2)I was silly for not showing the languages immediately. I do indeed have my computer's language set to English. And that seems to be causing the problem. Because when I set it to "Nederlands", Dutch (Belgium)... it shows DD-MM-YYYY in the date picker.

So the language is the thing, and it shouldn't. Am I right? In the righthand side of the pane you see how the date should be formatted But! When I set it to Dutch (Belgium) shows the date with, not with slashes...

In my opinion the date format should adhere to what's set in the preferences as the region's formatting, not the language someone speaks.
Comment 9 Jeroen Bensch 2020-11-04 23:24:18 PST
Created attachment 413255 [details]
Dutch (Belgium) date format
Comment 10 Jeroen Bensch 2020-11-04 23:25:26 PST
I meant to say it shows the date with dashes, not with slashes.
Comment 11 Jeroen Bensch 2020-11-10 00:10:57 PST
Do you think, Aditya, this will be followed up on. Or is this a "works as intended"?

One might argue that if you're English speaking (or say, a programmer or scientist, or someone working in an international environment) you might prefer your devices' languages to be English.

That doesn't mean you don't want to use the date format used in the US, when you live in Europe, or anywhere else for that matter (other than the obvious US of course).

I think it's wrong to have the date format follow the language. It should follow the region you live in.

Would you agree?
Comment 12 Aditya Keerthi 2020-11-10 16:39:56 PST
(In reply to Jeroen Bensch from comment #11)
> Do you think, Aditya, this will be followed up on. Or is this a "works as
> intended"?
> 
> One might argue that if you're English speaking (or say, a programmer or
> scientist, or someone working in an international environment) you might
> prefer your devices' languages to be English.
> 
> That doesn't mean you don't want to use the date format used in the US, when
> you live in Europe, or anywhere else for that matter (other than the obvious
> US of course).
> 
> I think it's wrong to have the date format follow the language. It should
> follow the region you live in.
> 
> Would you agree?

Hi Jeroen,

I agree that it would be better to follow the region from a usability standpoint. However, there is also a privacy concern here, since I don't believe we currently expose the user's region (in any manner) to websites.

I am actively following-up on this bug, and am in discussion with other members of the team. I will report back here once a decision has been made.
Comment 13 Jeroen Bensch 2020-11-10 16:56:05 PST
Alright,

Good to know you acknowledge the idea of following the region, not the language. Also not sure if the region gets exposed to the website... input type="date" is a replaceable element... afaik the website only gets to see something in the form of YYYY-MM-DD as that is the return value of every browser's date picker.

But I don't know much about it. In any case, thanks :)
Comment 14 Jeroen Bensch 2020-11-13 14:06:32 PST
Hello again,

Someone will have to restore my sanity and tell me this got fixed in macOS Big Sur... because after I upgraded and I just checked, Safari Technology Preview 115 _does_ show DD/MM/YYYY in the date picker in my region (Belgium) with English as language.

So Aditya, do you know more about this? Or am I seeing things?
Comment 15 Aditya Keerthi 2020-11-16 08:17:41 PST
(In reply to Jeroen Bensch from comment #14)
> Hello again,
> 
> Someone will have to restore my sanity and tell me this got fixed in macOS
> Big Sur... because after I upgraded and I just checked, Safari Technology
> Preview 115 _does_ show DD/MM/YYYY in the date picker in my region (Belgium)
> with English as language.
> 
> So Aditya, do you know more about this? Or am I seeing things?

Hello!

The format WebKit uses for the date still comes from `navigator.language`, so the change is likely due macOS system changes.

If you open Web Inspector and enter `navigator.language`, what is returned?

You should still be able to force the previous "MM/DD/YYYY" format by explicitly setting your first preferred language to "English (US)". In this case, `navigator.language` should show "en-US".
Comment 16 Jeroen Bensch 2021-02-12 03:06:31 PST
I seem to have forgotten to reply to your latest comment.

The navigator.language is "en-us".

I just want to have it "on record" that it should not follow the language, but the region. Other browsers can do it.

I'm not sure if/when it will ever be implemented, because it is not in Safari (only in the tech preview) but just be aware that there will be problems if this is not addressed.

It is also not matching what people see in their System Preferences->Language & Region.

My Region is Belgium and the dates in the window on the bottom are shown as:

Friday, 12 February 2021 at 11:58:33 CET
12/02/2021, 11:58

(the 12/02/2021 is the important one here, it's DD/MM/YYYY, but the date picker in Safari shows MM/DD/YYYY)

That's the bug, I don't think anything else needs to be said about it. Regardless of your language, the region has the date format. And the region's date format should be shown.

Thanks for the input so far :)
Comment 17 Aditya Keerthi 2022-02-14 10:22:45 PST
(In reply to Jeroen Bensch from comment #16)
> I seem to have forgotten to reply to your latest comment.
> 
> The navigator.language is "en-us".
> 
> I just want to have it "on record" that it should not follow the language,
> but the region. Other browsers can do it.
> 
> I'm not sure if/when it will ever be implemented, because it is not in
> Safari (only in the tech preview) but just be aware that there will be
> problems if this is not addressed.
> 
> It is also not matching what people see in their System
> Preferences->Language & Region.
> 
> My Region is Belgium and the dates in the window on the bottom are shown as:
> 
> Friday, 12 February 2021 at 11:58:33 CET
> 12/02/2021, 11:58
> 
> (the 12/02/2021 is the important one here, it's DD/MM/YYYY, but the date
> picker in Safari shows MM/DD/YYYY)
> 
> That's the bug, I don't think anything else needs to be said about it.
> Regardless of your language, the region has the date format. And the
> region's date format should be shown.
> 
> Thanks for the input so far :)

Hi Jeroen,

Thanks for following up. Unfortunately, we are still unable to honor the region (over language) for privacy reasons.

Would you mind expanding on what you mean by "because it is not in Safari (only in the tech preview)"? Are there differences in behavior between Safari and Safari Technology Preview?
Comment 18 Jeroen Bensch 2022-02-14 12:12:25 PST
I just checked and it is showing the same in Tech Preview as it is in Safari stable... so I don't know what I was seeing back then... maybe it worked for a while in TP, and then it didn't anymore?

I don't know... all I know is that now they both show MM/DD/YYYY while, in my opinion, they should be showing DD/MM/YYYY because my region is set to Belgium with the date standard European date format.

If the reason for this is privacy... and thus fingerprinting (I assume?) then maybe we could do YYYY/MM/DD to keep everyone (or no-one) happy.

In any case, was glad to hear some follow-up on this at least :)