Adjust getWeekOfYear to ISO8601 standard

First week of the year is th one with the first Thursday according to ISO8601
This commit is contained in:
walteruzzu 2016-02-02 13:07:56 +01:00
parent 704d50318f
commit bfc14e86fc

View File

@ -1453,6 +1453,9 @@
}
}
var onejan = new Date(datetime.getFullYear(), 0, 1);
//First week of the year is th one with the first Thursday according to ISO8601
if(onejan.getDay()!=4)
onejan.setMonth(0, 1 + ((4 - onejan.getDay()+ 7) % 7));
return Math.ceil((((datetime - onejan) / 86400000) + onejan.getDay() + 1) / 7);
};