Unplanned
Last Updated: 06 Apr 2020 13:53 by ADMIN
Wuttichai
Created on: 06 Apr 2020 13:50
Category: DatePicker
Type: Bug Report
2
Calendars throw when non-Gregorian cultures are used
For example, a Thai calendar causes exceptions in WASM because day names are missing
Attached Files:
1 comment
ADMIN
Marin Bratanov
Posted on: 06 Apr 2020 13:53

What I can say at the moment is that our calendar and derivative components (date picker, time picker, date time picker, date input) support only the Gregorian calendar.

The issue I see is that we rely on obtaining data about the culture and how it shortens days of the week from the framework, and those are unavailable in th-TH culture (here's a sample code you can use to see what you get in the console,  versus what you would get for a culture like fr-FR) - you will get the same error when trying to enumerate the data because it does not exist:

@code{
    void Test()
    {
        System.Globalization.DateTimeFormatInfo dateTimeFormat = System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat;
        var info = new Dictionary<string, object>()
        {
            ["abbreviated"] = dateTimeFormat.AbbreviatedDayNames,
            ["short"] = dateTimeFormat.ShortestDayNames,
            ["narrow"] = dateTimeFormat.DayNames.Select(month => month[0]),
            ["wide"] = dateTimeFormat.DayNames
        };

        foreach (string key in info.Keys)
        {
            Console.WriteLine("KEY: " + key);
            if (info[key] is string[])
            {
                foreach (string item in info[key] as string[])
                {
                    Console.WriteLine(item);
                }
            }
            else
            {
                IEnumerable<char> theDayNames = info[key] as IEnumerable<char>;
                foreach (var item in info[key] as IEnumerable<char>)
                {
                    Console.WriteLine(item);
                }
            }
        }
    }

    protected override void OnInitialized()
    {
        base.OnInitialized();
        Test();
    }
}

 

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.