Created
January 7, 2014 12:33
-
-
Save Krizzzn/8298656 to your computer and use it in GitHub Desktop.
2013-12-31 and 2014-1-1 should both be CW1, 2014, but aren't.
Happens in .NET 2.0 and 4.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void WrongCalendarWeekCalculation() | |
{ | |
var calendar = new System.Globalization.CultureInfo("en-US").Calendar; | |
var m1 = calendar.GetWeekOfYear(new DateTime(2013, 12, 31), System.Globalization.CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday); | |
var m2 = calendar.GetWeekOfYear(new DateTime(2014, 1, 1), System.Globalization.CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday); | |
Console.Write("m1= {0}; m2= {1}", m1, m2); //> m1= 53; m2= 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment