Thai Culture Date labels are Inconsistent

Pardeep Sharma 21 Reputation points
2021-12-03T10:25:29.9+00:00

I faced this Thai calendar issue a few days back but it got resolved with great community help.

Following the above bug, The Thai culture labels or date format are inconsistent when we update the Phone language (English --> Thai). Please check the labels displaying as 2021 instead of 2564.

154738-wrong-thai-date-label.png

Though the DatePicker is displaying fine:

154739-thai-datepicker-dialog.png

To display the date label, we are doing:

dateTime.ToString("dd MMM yyyy", CultureInfo.InvariantCulture)  
  

We are updating the CultureInfo at App.cs on configuration changed:

public override void OnConfigurationChanged([NotNull] Configuration newConfig)  
        {  
            base.OnConfigurationChanged(newConfig);  
  
            var javaLocale = newConfig.Locales.Get(0);  
            if (javaLocale != null)  
            {  
                ResetNetLocale(javaLocale);  
            }  
        }  
  
        private static void ResetNetLocale([NotNull] Locale javaLocale)  
        {  
            var cultureInfo = javaLocale.TryGetCultureInfo() ?? CultureInfo.InvariantCulture;  
  
            CultureInfo.CurrentUICulture = cultureInfo;  
            CultureInfo.CurrentCulture = cultureInfo;  
            CultureInfo.DefaultThreadCurrentCulture = cultureInfo;  
        }  

At listview item or other views to update the CultureInfo we are also using:

CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CurrentUICulture;  
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;  

Though other regions/culture labels eg. (France, German, etc.) are displaying fine. The only problem we are facing in Thai culture.

Any hint to solve the issue would be really helpful.

Developer technologies | .NET | Xamarin
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. JarvanZhang 23,971 Reputation points
    2021-12-06T04:11:14.217+00:00

    Hello PardeepSharma-8182,​

    Welcome to our Microsoft Q&A platform!

    I created a basic demo to test the function, and reproduce the issue. The date label is correct with 'Thai' culture, but the date of the picker cannot be converted to 'Thai' date. This may be a potential issue, it's suggested to report the issue to the github repo for a solution.

    Best Regards,

    Jarvan Zhang


    If the response is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.