Subject: | Jan 1 .. 3, 2010 considered week 53, week one for 2010 starts Jan 4 |
I've an app that sorts on week number and I noticed this problem when I saw the beginning of January was at the end of my list.
DateTime seems to be miscalculating the week_number() as you can see demonstrated below. (Unless I am overlooking some
nuance of week numbers?)
multivac:~ dmuey$ perl -MDateTime -le 'print DateTime->VERSION;'
0.53
multivac:~ dmuey$ perl -MDateTime -le 'print DateTime->new(day=>1,month=>1,year=>2010)->week_number();'
53
multivac:~ dmuey$ perl -MDateTime -le 'print DateTime->new(day=>2,month=>1,year=>2010)->week_number();'
53
multivac:~ dmuey$ perl -MDateTime -le 'print DateTime->new(day=>3,month=>1,year=>2010)->week_number();'
53
multivac:~ dmuey$ perl -MDateTime -le 'print DateTime->new(day=>4,month=>1,year=>2010)->week_number();'
1
multivac:~ dmuey$
Other years do this too.
Shouldn't January 1 be week 1?