You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On phones with the language set to Arabic we're seeing the following error when using the DatePickerCell
Error is System.ArgumentOutOfRangeException
Specified time is not supported in this calendar. It should be between 04/30/1900 00:00:00 (Gregorian date) and 11/16/2077 23:59:59 (Gregorian date), inclusive.
Parameter name: time
Steps to Reproduce
Change iOS simulator language to Arabic
Open a page with DatePickerCell
Expected Behavior
No crash 👍
Actual Behavior
Yes crash 😞
Platforms
Android
iOS
Basic Information
AiForms.SettingsView x1.0.9
Xamarin.Forms 4.6.1073
Android Support Library Version:
Affected Devices:
Stacktrace
at System.Globalization.UmAlQuraCalendar.CheckTicksRange (System.Int64 ticks) [0x0001a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/globalization/umalquracalendar.cs:384
at System.Globalization.UmAlQuraCalendar.GetDatePart (System.DateTime time, System.Int32 part) [0x0000d] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/globalization/umalquracalendar.cs:490
at System.Globalization.UmAlQuraCalendar.GetDayOfMonth (System.DateTime time) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/globalization/umalquracalendar.cs:587
at System.DateTimeFormat.FormatCustomized (System.DateTime dateTime, System.ReadOnlySpan`1[T] format, System.Globalization.DateTimeFormatInfo dtfi, System.TimeSpan offset, System.Text.StringBuilder result) [0x003b9] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/Globalization/DateTimeFormat.cs:586
at System.DateTimeFormat.FormatStringBuilder (System.DateTime dateTime, System.ReadOnlySpan`1[T] format, System.Globalization.DateTimeFormatInfo dtfi, System.TimeSpan offset) [0x000bb] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/Globalization/DateTimeFormat.cs:1132
at System.DateTimeFormat.Format (System.DateTime dateTime, System.String format, System.IFormatProvider provider, System.TimeSpan offset) [0x0009a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/Globalization/DateTimeFormat.cs:1037
at System.DateTimeFormat.Format (System.DateTime dateTime, System.String format, System.IFormatProvider provider) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/Globalization/DateTimeFormat.cs:1006
at System.DateTime.ToString (System.String format) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/DateTime.cs:1285
at AiForms.Renderers.iOS.DatePickerCellView.UpdateDate () [0x0003b] in <6fe2a7ae3f3a4c32b996efb9688dfe87>:0
at AiForms.Renderers.iOS.DatePickerCellView.UpdateMaximumDate () [0x0001b] in <6fe2a7ae3f3a4c32b996efb9688dfe87>:0
at AiForms.Renderers.iOS.DatePickerCellView.UpdateCell () [0x00006] in <6fe2a7ae3f3a4c32b996efb9688dfe87>:0
at AiForms.Renderers.iOS.CellBaseRenderer`1[TnativeCell].GetCell (Xamarin.Forms.Cell item, UIKit.UITableViewCell reusableCell, UIKit.UITableView tv) [0x00044] in <6fe2a7ae3f3a4c32b996efb9688dfe87>:0
at AiForms.Renderers.iOS.SettingsTableSource.GetCell (UIKit.UITableView tableView, Foundation.NSIndexPath indexPath) [0x00047] in <6fe2a7ae3f3a4c32b996efb9688dfe87>:0
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.3.2/src/Xamarin.iOS/UIKit/UIApplication.cs:86
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.3.2/src/Xamarin.iOS/UIKit/UIApplication.cs:65
at AgentApp.iOS.Application.Main (System.String[] args) [0x00001] in /Users/bdean/code/AgentAppNew/AgentApp.iOS/Main.cs:24
The text was updated successfully, but these errors were encountered:
I was able to find a workaround. In app.xaml.cs I'm manually changing the culture to one that uses a Gregorian calendar:
`
public App()
{
InitializeComponent();
System.Globalization.CultureInfo.DefaultThreadCurrentCulture = new System.Globalization.CultureInfo("en-US");
`
Note that this works for us because we handle i18n string substitution by setting the language in a setting. Then, when we do string substitutions we check the value in that setting, not the current culture. If you are relying on the CultureInfo then, obviously, this will change all of your app's language strings to English.
I've tested that this works on both iOS and Android. The date picker is still shown in the native language since it's a native control:
iOS:
Android:
I'm not sure what the solution is to fix this in AiForms.SettingsView.
Description
On phones with the language set to Arabic we're seeing the following error when using the DatePickerCell
Steps to Reproduce
Expected Behavior
No crash 👍
Actual Behavior
Yes crash 😞
Platforms
Basic Information
Stacktrace
The text was updated successfully, but these errors were encountered: