Author: miguel
Date: 2007-01-12 22:52:24 -0500 (Fri, 12 Jan 2007)
New Revision: 70945
Modified:
trunk/mcs/class/corlib/System.Globalization/ChangeLog
trunk/mcs/class/corlib/System.Globalization/DateTimeFormatInfo.cs
Log:
2007-01-12 Miguel de Icaza <[EMAIL PROTECTED]>
* DateTimeFormatInfo.cs: Add support for shortest day names.
Notice that there is no support in the runtime to actually load
this information from any place. So they are all english values.
Modified: trunk/mcs/class/corlib/System.Globalization/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Globalization/ChangeLog 2007-01-13
03:06:33 UTC (rev 70944)
+++ trunk/mcs/class/corlib/System.Globalization/ChangeLog 2007-01-13
03:52:24 UTC (rev 70945)
@@ -1,3 +1,9 @@
+2007-01-12 Miguel de Icaza <[EMAIL PROTECTED]>
+
+ * DateTimeFormatInfo.cs: Add support for shortest day names.
+ Notice that there is no support in the runtime to actually load
+ this information from any place. So they are all english values.
+
2007-01-07 Atsushi Enomoto <[EMAIL PROTECTED]>
* CompareInfo.cs : GetSortKey() does not allow Ordinal and
Modified: trunk/mcs/class/corlib/System.Globalization/DateTimeFormatInfo.cs
===================================================================
--- trunk/mcs/class/corlib/System.Globalization/DateTimeFormatInfo.cs
2007-01-13 03:06:33 UTC (rev 70944)
+++ trunk/mcs/class/corlib/System.Globalization/DateTimeFormatInfo.cs
2007-01-13 03:52:24 UTC (rev 70945)
@@ -50,7 +50,10 @@
private static readonly string[] INVARIANT_MONTH_NAMES
= new string[13] { "January", "February", "March",
"April", "May", "June", "July", "August", "September", "October", "November",
"December", ""};
private static readonly string[] INVARIANT_ERA_NAMES = {"A.D."};
-
+#if NET_2_0
+ static readonly string [] INVARIANT_SHORT_DAY_NAMES =
+ new string [7] {"Su", "Mo", "Tu", "We", "Th", "Fr",
"Sa"};
+#endif
private static DateTimeFormatInfo
theInvariantDateTimeFormatInfo;
//
@@ -91,6 +94,7 @@
private string [] allLongTimePatterns;
private string [] monthDayPatterns;
private string [] yearMonthPatterns;
+ private string [] shortDayNames;
//
// END OF BIG FAT WARNING
@@ -146,6 +150,9 @@
dayNames = INVARIANT_DAY_NAMES;
abbreviatedMonthNames =
INVARIANT_ABBREVIATED_MONTH_NAMES;
monthNames = INVARIANT_MONTH_NAMES;
+#if NET_2_0
+ shortDayNames = INVARIANT_SHORT_DAY_NAMES;
+#endif
}
public static DateTimeFormatInfo GetInstance(IFormatProvider
provider)
@@ -744,10 +751,33 @@
get { throw new NotImplementedException (); }
}
- [MonoTODO ("NotImplemented")]
+ public string [] ShortestDayNames {
+ get {
+ return shortDayNames;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException ();
+
+ if (value.Length != 7)
+ throw new ArgumentException ("Array
must have 7 entries");
+
+ for (int i = 0; i < 7; i++)
+ if (value [i] == null)
+ throw new ArgumentNullException
(String.Format ("Element {0} is null", i));
+
+ shortDayNames = value;
+ }
+ }
+
public string GetShortestDayName (DayOfWeek dayOfWeek)
{
- throw new NotImplementedException ();
+ int index = (int) dayOfWeek;
+ if (index < 0 || index > 6)
+ throw new ArgumentOutOfRangeException();
+
+ return shortDayNames [index];
}
[MonoTODO ("NotImplemented")]
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches