From bfc14e86fc3d24dda70e1cb72b828f14b979fd1c Mon Sep 17 00:00:00 2001 From: walteruzzu Date: Tue, 2 Feb 2016 13:07:56 +0100 Subject: [PATCH] Adjust getWeekOfYear to ISO8601 standard First week of the year is th one with the first Thursday according to ISO8601 --- jquery.datetimepicker.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jquery.datetimepicker.js b/jquery.datetimepicker.js index 780a6d0..de3620f 100644 --- a/jquery.datetimepicker.js +++ b/jquery.datetimepicker.js @@ -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); };