These aren't the MONTHS you're looking for (aka You'll never get to the 13th month *that* way)

by Michael S. Kaplan, published on 2011/12/13 07:01 -05:00, original URI:

The other day I had somebody call me out about a blog I wrote a little over a year ago. I'll excerpt the mail to avoid some of the more graphic language:

Dude, maybe you should read a little before you freaking write! If you query for month names of the current user default when you Hebrew is the default and the Hebrew calendar is selected, then the only way to *avoid* getting Hebrew months is passing the flag to ignore user overrides. Kind of a huge hole in the "logic" of that blog you wrote!

For the record, I replaced the word he used with freaking there. He used 饾摃饾摼饾摤饾摯饾摬饾摲饾摪 only he didn't do something clever with Unicode to avoid the publish filters.

I was not offended, sometimes mail kind of goes that way.

But there are a few things you should probably know about me:

First of all, sometimes I can be wrong. There are two types of situations where that can happen:

Now the fact that I don't care about the first category means the people who point those things out might not like me, but from my point of view I find them to be a waste of time, so that saves me a lot of time. And I can use that Free time to minimize the second category when possible!

Second of all, before you go down the road, you might want to try it yourself, and not trust what you might infer from the documentation.

I love our docs but I point out their real flaws all the time!

In this case, it is quite easy to change the Standards and Formats (aka default user locale) to Hebrew:

and then click the Additional settings... button and choose the Date tab to get to where you can change the calendar:

Once you do this, you'll see that we are now using the Hebrew calendar:

Now if while you are in this this situation, you call


you will get a zero length string.

And if you call


you will get


a.k.a December, not


a.k.a. Kislev.

Well, not really Kislev, but you probbly know what I mean.

You see, to the random person who sent me the mail, I knew of this particular limitation. And before I wrote and published Note to the NLS API: It ain't ever gonna by 13 o'clock, either., I tested it out explicitly to make sure the issue was still there.

Because when it's stuff I find interesting, I know it makes a 饾摃饾摼饾摤饾摯饾摬饾摲饾摪 difference to get things right....

In the end, although GetLocaleInfo/GetLocaleInfoEx have documented behavior related to the LOCALE_NOUSEROVERRIDE flag, the fact is that the different month names inherent in many alternate calendars have never been returned, even when the LOCALE_ICALENDARTYPE has been changed and the functions can detect this fact.

Only the user overrides you can drectly change are impacted, and the "secondary" data like month names aren't available through GetLocaleInfo[Ex].

Is it a bug?

Sure, kinda.

But it is a bug that has existed for as long as alternate calendars have. In almost ever copy of Windiws ever sold or stolen.

This fact is easily verified experimentally by anyone who takes the the time to do so.

Ideally before cursing me in my own inbox, though if not I can always write a blog about it!

Doug Ewell on 13 Dec 2011 10:47 AM:

Ah, I see you're making good use of again.

Michael S. Kaplan on 13 Dec 2011 11:46 AM:

<SECRETSHAME>I used the Word Insert Symbol dialog. that site would have been quicker!</SECRETSHAME>

Shachar Shemesh on 13 Dec 2011 12:11 PM:

Surely, the 12th month in the Hebrew calendar is 讗诇讜诇, not 讻住诇讜. Now, if you claim that the sixth month is 讗讚专 讗壮 and the seventh 讗讚专 讘壮, then the 12th month would still be 讗讘.鈥 讻住诇讜 is the third month, either count.

Or is that what you meant by "but you probably know what I mean", in which case, I know what you mean, but not that you meant it.


Simon Buchan on 13 Dec 2011 1:45 PM:

To see if I understand the issue, it's that GetLocaleInfo[Ex] only supports Gregorian calanders, but returns the month names from what the current locale's calander is, even if it's non-Gregorian (which makes no sense). From the examples you've given, it looks like it *could* be fixed by "simply" following the docs and returning the current calander's 13th month if it has one, but I don't know much about non-Gregorian calanders...

Annoyingly, Chrome doesn't do font fallback for your fancy swearing :)

Michael S. Kaplan on 13 Dec 2011 4:22 PM:

@Shachar -- yes, I know. I was just saying we weren't getting the Hebrew calendar, we get the Gregorian calendar localized into the Hebrew language....

Alex Cohn on 14 Dec 2011 11:57 AM:

@Shahar, some would argue that Kislev is number 9, because the first month is Nissan! But anyway, I would choose Adar bet to occupy the 13th slot, to emphasize its conditional existence.

Brian Tkatch on 16 Dec 2011 5:21 AM:

>@Shahar, some would argue that Kislev is number 9, because the first month is Nissan! But anyway, I would choose Adar bet to occupy the 13th slot, to emphasize its conditional existence.

Considering Esther 3:7 ( specifically describes it as such:

In the first month, that [is], the month Nisan, in the twelfth year of king Ahasuerus, they cast Pur, that [is], the lot, before Haman from day to day, and from month to month, [to] the twelfth [month], that [is], the month Adar.

I think counting Adar as 12 is more authentic. But English counts from the year, not the month. October is the eight month, yet 10th in the year, and so on. So, to be consistent, we'd want to count from the beginning of the year as well, making Adar number 6.

My gripe is the extra month is Adar Aleph, not Adar B..., and as my birthday is in Adar Aleph, i take it to heart. :)

Michael S. Kaplan on 16 Dec 2011 9:13 AM:

See this blog for the actual implementation....

referenced by

2011/12/15 I Adar you to guess how they make it work!

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