I won't Dari or double Dari you to knock our Persian calendar support...

by Michael S. Kaplan, published on 2011/12/28 08:51 -05:00, original URI: http://blogs.msdn.com/b/michkap/archive/2011/12/28/10251541.aspx

It was not too long ago (by some scales of time and duration, at least!) that the following question found its way into my inbox:

Why all famous calendars in the world are included in Microsoft Windows in the Date section, except Hejri Shamsi (Iranian Calendar)?! Does it have any political reason? Or it is only because you are not aware of the importance, accuracy and history of this calendar? Hejri Calendar has two branches, one is Hejri Ghamari (Lunar Hejri) and the other is Hejri Shamsi (Solar Hejri) and just the first one is included in Windows while the second one is more accurate.

This is a very complicated question.

And when i say complicated, I don't just mean complicated.

I mean complicated!

If you know what I mean.

Hell, even if you don't know what I mean!

Okay, we'll start from here. From now.

.Net supports the PersianCalendar class, which the documentation describes thusly:

The Persian calendar is used in most countries where Persian is spoken, although some regions use different month names. The Persian calendar is the official calendar of Iran and Afghanistan, and it is one of the alternative calendars in regions such as Kazakhstan and Tajikistan.
Dates in the Persian calendar start from the year of the Hijra, which corresponds to 622 C.E. and is the year when Muhammad migrated from Mecca to Medina. For example, the date March 21, 2002 C.E. corresponds to the first day of the month of Farvardeen in the year 1381 Anno Persico.
The Persian calendar is based on a solar year and is approximately 365 days long. A year cycles through four seasons, and a new year begins when the sun appears to cross the equator from the southern hemisphere to the northern hemisphere as viewed from the center of the Earth. The new year marks the first day of the month of Farvardeen, which is the first day of spring in the northern hemisphere.
Each of the first six months in the Persian calendar has 31 days, each of the next five months has 30 days, and the last month has 29 days in a common year and 30 days in a leap year. A leap year is a year that, when divided by 33, has a remainder of 1, 5, 9, 13, 17, 22, 26, or 30. For example, the year 1370 is a leap year because dividing it by 33 yields a remainder of 17. There are approximately eight leap years in every 33-year cycle.

Mind you, this already complicated description glosses over things a scosh, as befits anyone trying to compress a calendar system as old as this calendar - at times lunar, at times lunisolar, at times solar, at times starting in the "true Spring", at times starting at the birth of Cyrus the Great, and at times of the emigration of Muhammed, at times using Farsi/Persian, at times using Dari (which is mostly Farsi for month name purposes though I am really oversimplifyin here), at times with Pashto names, and...

I give up. See the Iranian calendars article for more detail on the variations over the millennia. Note that the lunar calendar has been out of favor since 1925, which has two interesting consequences for usa:

Both problems could have been addressed -- but it would be complicated to do so -- perhaps moreso than anyone would want to tackle here, and it may have just been considered out of scope.

Ranom factoid: during the .NE 2.0 beta, the PersianCalendar class was named the JalaliCalendar class, but this was fixed prior to RTM. The Jalali term is more accurately used to refer to the Persian lunar calendar, so this "breaking" change between Beta and RTM was a good one, in the sense that it was a correct one.

I kind of wish the analogious bug in the ThaiBuddhistCalendar class (described in The 'Thai Buddhist' calendar isn't) had been found during the .NET 1.0 beta and saved us all a much more serious conversation about a really complicated "correctness vs. backcompat" bug that may have to be tackled some day!

To date, we don't even have a KB articke or doc bug on this, AFAIK.

This is most interesting for Microsoft in general and Windows/.Net in particular since:

Note that the third problem can't be solved ntil/uless the secdond problem is -- we can't pick the "right" language if we don't know what culture to use.

So in the end, we are really underwhelming in our support for this small sheaf of calendars asociated with Persian -- wih both the solvable issues and the [at this point] largely unsolvable ones....

Random832 on 28 Dec 2011 11:55 AM:

Would a hybrid calendar that uses the lunar calendar before 1925 and the solar calendar after be possible, or would the transition run into issues similar to the ones that make one for the western civil calendar (Julian/Gregorian) impossible?

Michael S. Kaplan on 28 Dec 2011 4:32 PM:

Well, the issues are similar, but even more profound in terms of amount of change. So, possible in theory but different than anything we've ever done before....

Plus, the solar calendar was first proposed in 1911 -- which means the period from 1911 to 1925 would be a bigger nightmare to contemplate how to resolve conversions for.

Please consider a donation to keep this archive running, maintained and free of advertising.
Donate €20 or more to receive an offline copy of the whole archive including all images.

go to newer or older post, or back to index or month or day