Genitive dates, revisited

by Michael S. Kaplan, published on 2005/11/10 03:01 -05:00, original URI: http://blogs.msdn.com/b/michkap/archive/2005/11/10/491187.aspx


It was almost a year ago that I answered the question "What the %$#! are genitive dates?" on this blog.

And then today for some reason, the issue kept coming up again and again!

The day started with an international PM from Office asking for information about the Russian date formats in the .NET Framework 2.0 to look into a reported bug. I looked at the bugs assigned to her and found the information:

(I will leave out the steps since they relate to a product that I think it still in Beta)

Result:  Grammar for month strings like "June" is incorrect when they are preceded with a day number and are broken in the views in Step 3.  (See attached gif for details)

Expected:  Grammar should be correct for all views.

Check this out:

Still shows: 25 Октябрь 2005 г. .

Should be : 25 Октября 2005 г. - has one letter difference.

I don't know what version of URT(.Net framework) Explorer shows you , but code is using Whidbey v2.0.50727.42

I will admit that for a moment I panicked -- what if the functionality had somehow been broken? I immediately wrote some code to check it out:

using System;
using System.Globalization;

namespace Testing
{
    class Testing
    {

        [STAThread]
        static void Main(string[] args)
        {
            CultureInfo ci = new CultureInfo("ru-RU");
            DateTimeFormatInfo dtfi = ci.DateTimeFormat;

            for(int m = 0; m < 12; m++) {
                DateTime dt = new DateTime(2005, m + 1, 1);

                Console.Write(dtfi.MonthNames[m]);
                Console.Write('\t');
                Console.Write(dtfi.MonthGenitiveNames[m]);
                Console.Write('\t');
                Console.Write(dt.ToString("D", dtfi));
                Console.WriteLine();
            }
        }

    }
}

This code will create a nice list of months, genitive months, and a formatted date that would be expected to show the genitive month name rather than the nominative month name if it were there. I would check them all out but pay special attention to October since that was the one that was reported to be broken.

Then in the SDK Command Prompt, I compiled the code, changed the code page to 1251 (Cyrillic), and ran the program:

E:\test>csc BUG.cs
Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.42
for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.


E:\test>chcp 1251
Active code page: 1251

E:\test>BUG.exe
Январь  января  1 января 2005 г.
Февраль февраля 1 февраля 2005 г.
Март    марта   1 марта 2005 г.
Апрель  апреля  1 апреля 2005 г.
Май     мая     1 мая 2005 г.
Июнь    июня    1 июня 2005 г.
Июль    июля    1 июля 2005 г.
Август  августа 1 августа 2005 г.
Сентябрь        сентября        1 сентября 2005 г.
Октябрь октября 1 октября 2005 г.
Ноябрь  ноября  1 ноября 2005 г.
Декабрь декабря 1 декабря 2005 г.

E:\test>

And there you have it -- the .NET Framework was behaving properly. This program must have code in it that is doing some custom date formatting rather than letting the .NET Framework's built-in support do the right thing.

There is a lesson in there -- you can't make effective use of the globalization support in Windows or the .NET Framework if you don't try to use it fully....

 

This post brought to you by "ь" (U+044c, a.k.a. CYRILLIC SMALL LETTER SOFT SIGN)


# Mihai on 10 Nov 2005 4:19 AM:

Because you mention Office and .NET 2.0, I assume it is about Office 12.

But Office always got this wrong. Office 2003 still does it wrong, after I don't know how many versions.

# Michael S. Kaplan on 10 Nov 2005 9:04 AM:

Hi Mihai --

I don't think all of Office gets it wrong, though I could imagine some of it probably does!

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

2010/09/09 Latvian. Genitive. Oops.

2008/05/14 Windows is too busy being consistent with the user to be consistent with itself!

2007/08/04 A re-genitive post

2006/03/20 Practical Uses for Replacement Cultures/Locales

2005/11/12 One last post about genitive dates

2005/11/11 Any Sami speakers reading this blog? :-)

2005/11/10 Do genitive dates always work properly for Greek?

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