Skip to content

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

Description

@GoogleCodeExporter
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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions