question

PardeepSharma-8182 avatar image
0 Votes"
PardeepSharma-8182 asked RobCaplan edited

DatePicker not showing correct year (2021 should be 2564) for Thai culture

I am working on an App that supports various languages/cultures. But, the DatePicker controls seem buggy for the Thai culture:

154001-thai-date-picker-mismatch.png



I am working on an App that supports various languages/cultures. But, the DatePicker controls seem buggy for the Thai culture:

enter image description here

I tried applying ThreadCulture using (also tried CultureInfo.CurrentCulture or CultureInfo.CurrentUICulture):

CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture

and Applied ThaiBuddhhistCalendar:

_ = new System.Globalization.ThaiBuddhistCalendar();

but the widget Year always displays as 2021 instead of 2564.

Any hint to solve the issue would be really helpful.

dotnet-xamarinforms
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

JarvanZhang-MSFT avatar image
0 Votes"
JarvanZhang-MSFT answered JarvanZhang-MSFT edited

Hello,​

Welcome to our Microsoft Q&A platform!

but the widget Year always displays as 2021 instead of 2564.

I tested the code with 'Thai' culture and reproduced the issue. Xamarin.Forms.DatePicker provides the MaximumDate property, it defaults to the last day of the year 2100. We can customize the value to display the 2564 year, but the year of the center part can be 2100 at most.

<DatePicker MaximumDate="3000/12/01" Date="2564/12/01"/>

This may be because the year range of the picker is from 1900 to 2100 by default. Xamarin.Android is only a layer of wrapper for Android native libraries, no extra operations. It's a potential issue with native android, which you can turn to Reporting Bugs | Android Open Source Project for help.

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.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.