jijo-paulose / gwt-cal

Automatically exported from code.google.com/p/gwt-cal
0 stars 0 forks source link

calendarWeekIso will break in 2016 in locales where firstDayOfWeek==1 #183

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
There's a bug in DateUtils.java, line 317 :
        int thursdayDay = 4 + firstDayOfWeek;
should be 
        int thursdayDay = 4;
because thursday is always 4, whatever you start a week on.

To see an effect of the bug, you need year 2016 (which starts on a friday, so 
the +1 offset from firstDayOfWeek has an effect).
Try (with firstDayOfWeek==1) :
Date le2016_01_6 = new Date(116, 0, 6);
System.out.println(""+le2016_01_6+" is in "+calendarWeekIso(le2016_01_6));

it prints 2, should be 1. All week numbers in 2016 are then similarly offset by 
1.

Original issue reported on code.google.com by Samuel.K...@gmail.com on 2 Oct 2013 at 9:46

GoogleCodeExporter commented 8 years ago
The issue should be fixed in rev 449.

The code was flawed in different ways. I hope that the new version works better 
and it's also easier to understand.

Original comment by ctasada on 8 Oct 2013 at 10:13