vendure-ecommerce / vendure

The commerce platform with customization in its DNA.
https://www.vendure.io
Other
5.56k stars 986 forks source link

LocaleDate displays incorrect time format for certain locales #2970

Closed williamrijksen closed 1 month ago

williamrijksen commented 1 month ago

Describe the bug The I18n LocaleDate shows a 12-hour format, while in my country it should not show AM/PM, but a 24-hour format instead.

To Reproduce Steps to reproduce the behavior:

  1. Make sure the locale of your browser is set to NL_nl.
  2. Login.
  3. Open the orders.
  4. Notice that the time is shown in the 12-hour format.

Expected behavior I expect the time to be displayed in the format of my locale, which is a 24-hour format.

Environment: @vendure/core version: v3

michaelbromley commented 1 month ago

Thanks for opening the issue.

This behaviour is controlled by the hour12 property.

From the MDN docs (my emphasis added):

Whether to use 12-hour time (as opposed to 24-hour time). Possible values are true and false; the default is locale dependent.

Looking at the localeDatePipe source code I can see that we are explicitly setting hour12: true,.

So we should just be able to omit this property and then the correct format will be used for the current locale.