I am currently reviewing the globalization process for a project (.net mvc2 application), and for me globalization is a bit new. I noticed that DateTime.ToString () when formatting for some cultures can lead to a redundancy of ArgumentOutOfRangeException for values ββtoo far in the past or future. In particular, the calendars used for "ar" and "ar-SA" ( UmAlQuraCalendar ) have very limited minimum and maximum supported dates. When using UmAlQuraCalendar, any date before April 1930 or after May 2029 will result in this. This is easy to observe:
DateTime.ParseExact("1900", "yyyy", CultureInfo.InvariantCulture).ToString("G", new CultureInfo("ar"));
Forgive my ignorance on this subject, but I wonder what the best practice is here. I would like for me to be able to represent dates earlier than 1930 without having to add exception handling every time I print the date, but I would also like to respect the user's culture. Is it better here to switch to calendars for these cultures? It seems that from some search queries, optionally HijriCalendar is very similar to UmAlQuraCalendar, but with much more relaxed minimum and maximum supported dates. Is this a problem that many people face? I could not find a lot of advice on this particular problem. I hesitate to simply change the default calendar used in these cultures on a whim, without any advice.
source share