Declined
Last Updated: 11 Oct 2022 09:23 by ADMIN
Franz
Created on: 04 Oct 2022 15:26
Category: Kendo UI for jQuery
Type: Bug Report
1
AM/PM designators are not correct for de-DE culture

Hello kendoUI Team,

I am 98% sure the following is a bug: https://dojo.telerik.com/UZuKImUs/2

In this Dojo link, the AM/PM designators are logged to the console for the cultures en-US and de-DE. They appear to be empty for de-DE. Consequently, a custom format string "yyyy.MM.dd hh:mm:ss tt" will result in a formatted Date without the AM/PM designator at the end for the de-DE culture, instead ending with a trailing whitespace (i.e. the whitespace between "ss" and "tt" in the format string).

The JS console output for this Dojo code is:

AM designator(s) for en-US culture: AM, am, AM
PM designator(s) for en-US culture: PM, pm, PM
Format "yyyy.MM.dd hh:mm:ss tt" for en-US culture: "2011.01.01 12:27:36 PM"
AM designator(s) for de-DE culture:
PM designator(s) for de-DE culture:
Format "yyyy.MM.dd hh:mm:ss tt" for de-DE culture: "2011.01.01 12:27:36 "

Contrast this with the following equivalent .NET snippet:

using System.Globalization;

var testDate = new DateTime(2011, 1, 1, 12, 27, 36, 952);
var dateTimeTestFormat = "yyyy.MM.dd hh:mm:ss tt";

Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
Console.WriteLine($"AM designator(s) for en-US culture: {Thread.CurrentThread.CurrentCulture.DateTimeFormat.AMDesignator}");
Console.WriteLine($"PM designator(s) for en-US culture: {Thread.CurrentThread.CurrentCulture.DateTimeFormat.AMDesignator}");
Console.WriteLine($"Format \"{dateTimeTestFormat}\" for en-US culture: {testDate.ToString(dateTimeTestFormat)}");

Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
Console.WriteLine($"AM designator(s) for de-DE culture: {Thread.CurrentThread.CurrentCulture.DateTimeFormat.AMDesignator}");
Console.WriteLine($"PM designator(s) for de-DE culture: {Thread.CurrentThread.CurrentCulture.DateTimeFormat.AMDesignator}");
Console.WriteLine($"Format \"{dateTimeTestFormat}\" for de-DE culture: {testDate.ToString(dateTimeTestFormat)}");

The output of this C# code is:

AM designator(s) for en-US culture: AM
PM designator(s) for en-US culture: AM
Format "yyyy.MM.dd hh:mm:ss tt" for en-US culture: 2011.01.01 12:27:36 PM
AM designator(s) for de-DE culture: AM
PM designator(s) for de-DE culture: AM
Format "yyyy.MM.dd hh:mm:ss tt" for de-DE culture: 2011.01.01 12:27:36 PM

While I am aware that kendo.culture cannot be a carbon copy of .NET's CultureInfo, I'm pretty sure that the missing AM/PM designators for the "de-DE" culture (possibly for others as well!) are an oversight in this particular case.

1 comment
ADMIN
Neli
Posted on: 11 Oct 2022 09:23

Hi Franz,

The described issue is caused by the AM and PM being an empty string in the 'de-DE' culture definition. However, this is intended as AM and PM are not set to every culture. For example, if you try to change the region format in Windows when Germany is selected, the AM and PM will not be present as well (screencast).  

If you need to modify the culture definition and display the 'am' and 'pm' for 'de-DE' culture you can use the example below:

AM: ["AM","am","AM"],
PM: ["PM","pm","PM"],

Here is a Dojo example where the designators are logged as expected. 

Let me know in case you have additional questions on the matter.

Regards,
Neli
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.