Author: rolf
Date: 2007-06-01 13:00:02 -0400 (Fri, 01 Jun 2007)
New Revision: 78435

Modified:
   trunk/mcs/class/corlib/ChangeLog
   trunk/mcs/class/corlib/System.Globalization/ChangeLog
   trunk/mcs/class/corlib/System.Globalization/DateTimeFormatInfo.cs
   trunk/mcs/class/corlib/System.Globalization/GregorianCalendar.cs
   trunk/mcs/class/corlib/Test/System.Globalization/ChangeLog
   trunk/mcs/class/corlib/Test/System.Globalization/DateTimeFormatInfoTest.cs
   trunk/mcs/class/corlib/corlib_test.dll.sources
Log:
In .:
2007-05-31  Rolf Bjarne Kvinge  <[EMAIL PROTECTED]>

        * corlib_test.dll.sources : added DateTimeFormatInfoTest.cs.

In Test/System.Globalization:
2007-05-31  Rolf Bjarne Kvinge  <[EMAIL PROTECTED]>

        * DateTimeFormatInfo.cs: Added EraName.

In System.Globalization:
2007-05-31  Rolf Bjarne Kvinge  <[EMAIL PROTECTED]>

        * GregorianCalendar.cs: Change era names from C.E./Common Era 
        to AD/A.D.
        * DateTimeFormatInfo.cs: GetEra: search the abbreviated era names
        as well for the era, and return the era, not the index of the era 
        in the array.



Modified: trunk/mcs/class/corlib/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/ChangeLog    2007-06-01 16:56:38 UTC (rev 78434)
+++ trunk/mcs/class/corlib/ChangeLog    2007-06-01 17:00:02 UTC (rev 78435)
@@ -1,3 +1,7 @@
+2007-05-31  Rolf Bjarne Kvinge  <[EMAIL PROTECTED]>
+
+       * corlib_test.dll.sources : added DateTimeFormatInfoTest.cs.
+
 2007-05-25  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
        * corlib_test.dll.sources : added ResourceWriterTest.cs.

Modified: trunk/mcs/class/corlib/System.Globalization/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Globalization/ChangeLog       2007-06-01 
16:56:38 UTC (rev 78434)
+++ trunk/mcs/class/corlib/System.Globalization/ChangeLog       2007-06-01 
17:00:02 UTC (rev 78435)
@@ -5,6 +5,14 @@
          consider that the max days in the target month (for AddYears()
          leap year month could matter). Fixed bug #81783.
 
+2007-05-31  Rolf Bjarne Kvinge  <[EMAIL PROTECTED]>
+
+       * GregorianCalendar.cs: Change era names from C.E./Common Era 
+       to AD/A.D.
+       * DateTimeFormatInfo.cs: GetEra: search the abbreviated era names
+       as well for the era, and return the era, not the index of the era 
+       in the array.
+
 2007-05-25  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
        * IdnMapping.cs : new 2.0 class.

Modified: trunk/mcs/class/corlib/System.Globalization/DateTimeFormatInfo.cs
===================================================================
--- trunk/mcs/class/corlib/System.Globalization/DateTimeFormatInfo.cs   
2007-06-01 16:56:38 UTC (rev 78434)
+++ trunk/mcs/class/corlib/System.Globalization/DateTimeFormatInfo.cs   
2007-06-01 17:00:02 UTC (rev 78435)
@@ -240,7 +240,15 @@
                                if (CultureInfo.InvariantCulture.CompareInfo
                                        .Compare (eraName, eras [i],
                                        CompareOptions.IgnoreCase) == 0)
-                                       return i;
+                                       return calendar.Eras [i];
+                       
+                       eras = calendar.AbbreviatedEraNames;
+                       for (int i = 0; i < eras.Length; i++)
+                               if (CultureInfo.InvariantCulture.CompareInfo
+                                       .Compare (eraName, eras [i],
+                                       CompareOptions.IgnoreCase) == 0)
+                                       return calendar.Eras [i];
+                       
                        return -1;
                }
 

Modified: trunk/mcs/class/corlib/System.Globalization/GregorianCalendar.cs
===================================================================
--- trunk/mcs/class/corlib/System.Globalization/GregorianCalendar.cs    
2007-06-01 16:56:38 UTC (rev 78434)
+++ trunk/mcs/class/corlib/System.Globalization/GregorianCalendar.cs    
2007-06-01 17:00:02 UTC (rev 78435)
@@ -477,8 +477,8 @@
        /// </param>
        public GregorianCalendar(GregorianCalendarTypes type) {
                CalendarType = type;
-               M_AbbrEraNames = new string[] {"C.E."};
-               M_EraNames = new string[] {"Common Era"};
+               M_AbbrEraNames = new string[] {"AD"};
+               M_EraNames = new string[] {"A.D."};
                if (twoDigitYearMax == 99)
                        twoDigitYearMax = 2029;
        }

Modified: trunk/mcs/class/corlib/Test/System.Globalization/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/Test/System.Globalization/ChangeLog  2007-06-01 
16:56:38 UTC (rev 78434)
+++ trunk/mcs/class/corlib/Test/System.Globalization/ChangeLog  2007-06-01 
17:00:02 UTC (rev 78435)
@@ -3,6 +3,10 @@
        * CalendarTest.cs : test for bug #81783 and AddYears() for leap year
          (similar issue).
 
+2007-05-31  Rolf Bjarne Kvinge  <[EMAIL PROTECTED]>
+
+       * DateTimeFormatInfo.cs: Added EraName.
+
 2007-05-25  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
        * IdnMappingTest.cs : new test.

Modified: 
trunk/mcs/class/corlib/Test/System.Globalization/DateTimeFormatInfoTest.cs
===================================================================
--- trunk/mcs/class/corlib/Test/System.Globalization/DateTimeFormatInfoTest.cs  
2007-06-01 16:56:38 UTC (rev 78434)
+++ trunk/mcs/class/corlib/Test/System.Globalization/DateTimeFormatInfoTest.cs  
2007-06-01 17:00:02 UTC (rev 78435)
@@ -48,6 +48,19 @@
                        string [] two = dtfi.GetAllDateTimePatterns ();
                        Assert (one != two);
                 }
+
+               [Test]
+               public void EraName ()
+               {
+                       CultureInfo en_US = new CultureInfo ("en-US");
+                       DateTimeFormatInfo dtfi = en_US.DateTimeFormat;
+                       AssertEquals ("#1", "AD", dtfi.GetAbbreviatedEraName 
(0));
+                       AssertEquals ("#2", "A.D.", dtfi.GetEraName (1));
+                       AssertEquals ("#3", 1, dtfi.GetEra ("A.D."));
+                       AssertEquals ("#4", 1, dtfi.GetEra ("AD"));
+                       AssertEquals ("#5", -1, dtfi.GetEra ("C.E"));
+                       AssertEquals ("#6", -1, dtfi.GetEra ("Common Era"));
+               }
 #if !TARGET_JVM
                [Test]
                public void Bug78569 ()
@@ -56,7 +69,7 @@
                        CultureInfo ci = new CultureInfo ("en-GB");
                        string s = dt.ToString (ci);
                        DateTime dt2 = DateTime.Parse (s, ci);
-                       Assert.AreEqual (dt.Month, dt2.Month);
+                       AssertEquals ("1", dt.Month, dt2.Month);
                }
 #endif
         }

Modified: trunk/mcs/class/corlib/corlib_test.dll.sources
===================================================================
--- trunk/mcs/class/corlib/corlib_test.dll.sources      2007-06-01 16:56:38 UTC 
(rev 78434)
+++ trunk/mcs/class/corlib/corlib_test.dll.sources      2007-06-01 17:00:02 UTC 
(rev 78435)
@@ -57,6 +57,7 @@
 System.Globalization/CalendarTest.cs
 System.Globalization/CompareInfoTest.cs
 System.Globalization/CultureInfoTest.cs
+System.Globalization/DateTimeFormatInfoTest.cs
 System.Globalization/DaylightTimeTest.cs
 System.Globalization/IdnMappingTest.cs
 System.Globalization/RegionInfoTest.cs

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to