Skip to content

Times and dates not formatted correctly for language #17409

@kraftvaerk-chth

Description

@kraftvaerk-chth

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

14.3.1

Bug summary

When setting the UI language in user settings to danish, dates and times are formatted incorrectly in date picker fields
MM/DD/YYYY instead of DD/MM/YYYY as well as AM/PM instead of 24-hour format

Also happens despite setting order of preferred locale in the browser (see system information screenshot in specifics)

Instead, the date+time formats seem to be dictated by the browser UI language

Specifics

https://localhost:44310/umbraco/section/user-management/view/users/user/edit/XXXXXX
image

https://localhost:44310/umbraco/section/content/workspace/document/edit/XXXXXX
image

When opening System Information (top left, click on the Umbraco Icon and open System Settings):
image

Swapping the browser UI language (green text indicator - NOT the order of the languages) is the only thing that makes the format display correctly)
image
Seems to happen due to using Date.toLocaleString() in js
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString

Steps to reproduce

Create a content type with a date+time picker
Set your chosen language to danish
Open a document of the content type you created

Expected result / actual result

Expected result:
Your chosen language in the user settings, will ensure the dates and times are formatted according to the chosen language

Actual result:
Dates and times are formatted by the chosen browser UI language - Chosen language in user settings is ignored


This item has been added to our backlog AB#48693

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions