mirror of
https://github.com/xdan/datetimepicker.git
synced 2024-11-18 06:24:22 +00:00
Merge pull request #384 from walteruzzu/patch-1
Adjust getWeekOfYear to ISO8601 standard
This commit is contained in:
commit
8bbdee0463
@ -1453,6 +1453,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var onejan = new Date(datetime.getFullYear(), 0, 1);
|
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);
|
return Math.ceil((((datetime - onejan) / 86400000) + onejan.getDay() + 1) / 7);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user