Why I don't like the JapaneseCalendar class #1: Respecting (or at least admitting) the history....

by Michael S. Kaplan, published on 2011/02/26 07:01 -05:00, original URI: http://blogs.msdn.com/b/michkap/archive/2011/02/26/10134403.aspx


Ever since I wrote About the Y1C problem, which really isn't too much of a problem (except maybe in North Korea)...when I said I'd probably say a word about the Japanese calendar, I knew I'd eventually be saying something about the Japanese calendar.

The fact is that the Microsoft implementation of the Japanese Imperial calendar has always bothered me. For many different reasons.

Thus this new series....

Now my dislike is not because of the principal issue I mentioned in Long live the Emperor, a not-as-uncommon-as-it-should-be complaint I hear from non-Japanese developers about the calendar who, despite being type of nerds who would never truly take violent rhetoric to the level of suggesting Microsoft predict the date of the death and/or end of rule of the Emperor nevertheless unknowingly advocate for the Emperor to leave office.

The fact that the problem continues to crop up is a reflection on the people making the complaint, not of the calendar itself.

And also not because of the principal issue I mentioned in Y oh Y does YYYY sometimes mean YY, you ask?, because although it can sometimes be confusing, the hypothetical need to support eras of over 100 years is proven wrong rather readily.

In both cases, perceived inconsistencies that in fact mirror actual usage of the calendar do not bother me; they only bother people too caught up in the technical issues to understand or even notice those usage issues.

And yet the problems I do have with this calendar and in their own way kind of brought up in both articles.

For a hint, I'll suggest thinking about the frustrations I have with the Umm-Al Qurah calendar of Saudi Arabia that I discuss in Long term planning is not always done.

If one recognizes some of the limitations of using a religious calendar like the Hijri one to deal with civil matters to such a degree that you create a whole new calendar like Saudi Arabia did here, it seems almost irresponsible to have the period it supports be so short that common scenarios like machine certificates and such will fail when you try to use such a calendar.

In the case of the Japanese calendar, my concern is not really on Japan though. It is on Microsoft.

It just seems ridiculous that when we have millennia of attested data (and even more unattested, legendary data) on the Japanese monarchs (e.g. see the List of Japanese monarchs in Wikipedia) that we limit ourselves to the last four eras (平成, 昭和, 大正, and 明治).

Why wouldn't we stretch this out a little further than that?

Like at least to where the historical Gregorian years are reasonable to use....

I mean, it is more than just ironic that you can use the GregorianCalendar to refer to dates that exist before the calendar existed yet you cannot use the JapaneseCalendar to refer to dates that were well within its range

The design of the calendar, however, which considers the current era to be #4, they left no architectural room for the up to 121 previous eras for the up to 117 previous rulers.

I suppose they could work around this by taking advantage of the fact that a System.Int32 is being used for the era-related methods and use negative numbers for the ones prior to "era #1" though this is less than ideal for a bunch of reasons. If I ever chose to fix this bug I'd create a new class and do it right from scratch.

But there are other reasons I dislike our implementation of the JapaneseCalendar class, which I will continue to talk about in part 2....


Brendan Elliott on 26 Feb 2011 1:14 PM:

Ack, that's embarrassing... :(

My Sharp Japanese electronic dictionary (purchased in Japan) has a calendar mode where you can look up the corresponding years between the Japanese/Western calendars by entering the year in terms of the Western calendar or the last four eras.  If you look up by Western calendar, it starts at 593 (basically start of Asuka Period 飛鳥時代), although the there are many gaps that only list the historical period until around 701.  Of course then you also get into parallel calendars for the north/south parts of the country for many of the years between 1331-1392 when there were two rival Emperors and two capitals (Nanboku-chou Period 南北朝時代).  That being said, there's really not much excuse for the calendar class going back to at least 1393...

Michael S. Kaplan on 26 Feb 2011 1:16 PM:

Exactly. And it gets worse.... :-/

Mihai on 1 Mar 2011 2:05 PM:

Once I get home, I can send you the registry file that adds a bunch of eras for Win 7 (Wikipedia based). So once older OSes get deprecated, the way forward is opened for easy fixing (including by MS :-)


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.

referenced by

2011/08/09 I guess the Y1C issue may kinda be a problem after all....

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