For the last couple of weeks, I've been working on customization of a control, to be able to work correctly with Persian, Arabic and English cultures. The major headache with these cultures, is of course, their Calendars!
While English was very easy to do, Arabic was a little harder, but for Persian it was a real pain in the neck. The problem is in FA-IR culture, the default calendar for the CultureInfo is NOT set to Persian Calendar provided by Microsoft!
In fact, back when .NET Framework 2.0 was released with the very good news of built-in Persian Calendar, I immediately found it very frustrating : Not only the provided calendar has a bug which makes it useless (who needs a calendar that miscalculates the year, anyway), they didn't make it the default calendar for the FA-IR culture!? The funny thing is, the default calendar for FA-IR was remained Gregorian Calendar, which we NEVER use casually.
I'm quite aware that already existing user controls that use DateTime extensively, probably will not work with Persian Calendar. This is probably, because of minimum representable date in Persian Calendar (PersianCalendar.MinSupportedDateTime) which is year 622 in Gregorian Calendar, but this should not mislead the guys at Microsoft to select GregorianCalendar for Persians, would it?
Anyway, I've proposed this change to happen, through Microsoft Connect. Please vote to fix the issue so, hopefully, we could all live in a better place :) The link is here.
While English was very easy to do, Arabic was a little harder, but for Persian it was a real pain in the neck. The problem is in FA-IR culture, the default calendar for the CultureInfo is NOT set to Persian Calendar provided by Microsoft!
In fact, back when .NET Framework 2.0 was released with the very good news of built-in Persian Calendar, I immediately found it very frustrating : Not only the provided calendar has a bug which makes it useless (who needs a calendar that miscalculates the year, anyway), they didn't make it the default calendar for the FA-IR culture!? The funny thing is, the default calendar for FA-IR was remained Gregorian Calendar, which we NEVER use casually.
I'm quite aware that already existing user controls that use DateTime extensively, probably will not work with Persian Calendar. This is probably, because of minimum representable date in Persian Calendar (PersianCalendar.MinSupportedDateTime) which is year 622 in Gregorian Calendar, but this should not mislead the guys at Microsoft to select GregorianCalendar for Persians, would it?
Anyway, I've proposed this change to happen, through Microsoft Connect. Please vote to fix the issue so, hopefully, we could all live in a better place :) The link is here.
Filed under


HEskandari said
September 16, 2009
It's nothing that "YOU" can solve! It's nothing that "I" can fix! Unless one of us is working in BCL team over at Microsoft!
You didn't get the whole point. I've had a WORKAROUND (definitely does not count as a fix) in my Farsi Library.
But the real thing is, not a lot of people use 3rd party controls or codes in their application and FA-IR culture should work correctly out of the box.
HEskandari said
September 16, 2009
I solve it.
please visit:
http://www.codeproject.com/KB/dotnet/PersianCulture.aspx
or
for iranian people visit:
http://www.artofprogramming.blogfa.com
HEskandari said
September 16, 2009
hey, dude!
First off, the problem reported on Microsoft Connect by someone named "Kourosh" may be a bug, or may not be, that's something left for Microsoft guys to decide! The problem I've reported through Microsoft Connect was the fact that PersianCalendar is not set as default calendar of FA-IR. It might not be a good idea to categorize it under "BUGS", but it is a frustrating shortcoming that I'm sure guys tried to use it completely agree.
I guess YOU should read with your eyes open.
HEskandari said
September 16, 2009
I didn't say there's NO way of doing it. There is already a nice subclassed CultureInfo in my FarsiLibrary project, with proper Calendar and DateTimeFormatInfo (using reflection, like the link you mentioned), but I don't believe that's a proper thing to do.
HEskandari said
September 16, 2009
Dear Friend,
i've found this link and I hope this may help you.
http://forums.msdn.microsoft.com/en-US/netfxbcl/thread/4768d48e-aa04-4c15-b688-a58fa4373bc9/
HEskandari said
September 16, 2009
Dude, that's not a bug. It seems you're not able to use PersianCalendar correctly. Don't report bogus bugs on connect when you're not sure. RTFM first.