bitfoundation / bitplatform

Build all of your apps using what you already know and love ❤️
https://bitplatform.dev
MIT License
1.08k stars 222 forks source link

`BitDatePicker` culture is not correct on Android #6927

Closed mhrastegari closed 7 months ago

mhrastegari commented 8 months ago

The year should be Shamsi but instead shows Gregorian!

image

STRstark commented 8 months ago

Not only the year is not correctly been changed into jalali calender , but also the date thats been picked by the components is not the one that the compunents puts into its place holder.

ysmoradi commented 7 months ago

image There's not much we can do at this stage, I'd expect 1402, but I received 2024!

ysmoradi commented 7 months ago

Use the following codes to change the culture info the way it works as you expect.

    cultureInfo.GetType().GetField("_calendar", BindingFlags.NonPublic | BindingFlags.Instance)!.SetValue(cultureInfo, new PersianCalendar());

    cultureInfo.DateTimeFormat.AMDesignator = "ق.ظ";
    cultureInfo.DateTimeFormat.PMDesignator = "ب.ظ";
    cultureInfo.DateTimeFormat.ShortDatePattern = "yyyy/MM/dd";
    cultureInfo.DateTimeFormat.AbbreviatedDayNames =
    [
        "ی", "د", "س", "چ", "پ", "ج", "ش"
    ];
    cultureInfo.DateTimeFormat.ShortestDayNames =
    [
        "ی", "د", "س", "چ", "پ", "ج", "ش"
    ];

    return cultureInfo;