Calculating WeekNumber in MonoTouch - bug like in .net?
-
12-11-2019 - |
Question
In the .Net-Framework there is a known bug when trying to calculate the weeknumber with ISO-8601.
Short-Description: "When determining the week number of a date according to the ISO 8601 standard, the underlying function call to the Oleaut32.dll file mistakenly returns week 53 instead of week 1 for the last Monday in certain years." (Source: Microsoft)
My Question: Is this bug also 'included' in MonoTouch and I have to use the workaround, or is it fixed in MonoTouch? The MonoTouch-API-Reference is not a big help here...
UPDATE: As I was told in the comments I did a few tests on my own. Example-Code follows
DateTime first = new DateTime(1851,12,29);
DateTime second = new DateTime(2011,12,30);
DateTime third = new DateTime(1895,12,30);
System.Globalization.Calendar objCal = System.Globalization.CultureInfo.CurrentCulture.Calendar;
int weekNumberFirst = objCal.GetWeekOfYear (first, System.Globalization.CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);
int weekNumberSecond = objCal.GetWeekOfYear (second, System.Globalization.CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);
int weekNumberThird = objCal.GetWeekOfYear (third, System.Globalization.CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);
Console.WriteLine (weekNumberFirst +" "+weekNumberSecond+" "+weekNumberThird);
Supposed Output: 1 52 1
Actual Output: 53 52 53
But would still be nice, to have some "official statement" for this...
No correct solution