Date picker only works with US date and time formats

Created on 12 January 2018, over 6 years ago
Updated 16 May 2023, about 1 year ago

Problem/Motivation

Up to Drupal 7, the default date format was the ISO standard YYYY-mm-dd Commands:HH:mm. So where the date format, couldn't be set (such in the node/add forms) this was used.
Users could also add a timezone correction, such as (+2). There is an issue for this regression ✨ [PP-1] Add ability to select a timezone for datetime field Postponed .

In Drupal 8, a new "Fallback date format". This usese the US date format mm-dd-YY and a 12 hour clock with am/pm.
This date format is used in the US and a few other countries such as Marshall islands. The 12 hour clock with the am/pm suffix is only used in English and some Spanish speaking countries. Other languages don't have this concept for writing down times, and also no translation for "am/pm".

The date picker widget is hard-coded to use this fallback date format. This means that whenever uses the date picker, afterwards the form will display this US date format - no matter what other date formats the site uses. The user cannot change this.
Anybody who wants to type in the date is only sees mm/dd/yyyy.
This cannot be translated, even though it at least should be for example mm-tt-jjjj in German.

The time can be typed in the 24 hr format, but is then automatically changed to 12 hr format. Users have to choose AM or PM even if they have no idea what that means.

An example: If I enter date and time today using the date picker widget on a German Drupal site today, I expect something like 12-01-2018 16:00.
But what I see is 01/12/2018 04:00:00 pm. To me that looks like I mistyped, and I might correct it until I notice that it's getting changed every time. Or might look at this in a year or so, and wonder why I picked the wrong date....

I expect 12/01/2018 16:00 here.

If the user adds a date field to an entity this can at least be mitigated by choosing the select fields instead. That way we loose the ease of the date picker, but at least the date and time in the filled-in form doesn't look wrong.

However, the date picker widget is also hard-coded to be used for the "Authored on" field of the article and page content type. The user cannot change this, and it's not even possible to add any description text, to alert other users of the fact that this is in the US date format. This is even more confusing, when the short date format has been changed, because then the user sees two different date formats with no indication that this is the case. So it looks like two different dates.
To add insult to injury: the hard-coded description text still says that the date is in the format yyyy-mm-dd Commands:HH:mm.

So for the improved UX of having a date picker, we end up with one that only makes sense in the US, and a confusing UX experience for anybody outside the US who looks at the "Authored on" date on a node edit form.

Proposed resolution

The best solution would be if users could set the date format in which the picked date is displayed on the form.

This would ideally include both the order of day, month and year; their display; and the connectors (/ or - or so); as well as the display of the time. Obviously it needs ensuring that all 6 values are present.
Adding the timezone correction would fix the regression from D7 to D8 for the authored date for node content.

If this is not possible then there should at least should be two or three date options to choose from (yyyy-mm-dd, dd-mm-yyyy, mm/dd/yyyy) and the option to choose between 24 or 12 hr clock.

And the description text for the node edit form needs to be changed to reflect the changed date format.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

10.1 ✨

Component
DatetimeΒ  β†’

Last updated about 8 hours ago

Created by

πŸ‡³πŸ‡±Netherlands ifrik

Live updates comments and jobs are added and updated live.
  • Usability

    Makes Drupal easier to use. Preferred over UX, D7UX, etc.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¦πŸ‡ΉAustria elek

    Thank you @mpdonadio, #3 made all clear for me. Don't know why I hat US-english instead of german in my browser settings. Well, I don't care or play around with those settings.

Production build 0.69.0 2024