1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-10-19 09:47:38 +00:00

Fix for #2634 problem with week calculations (#2635)

This commit is contained in:
Mario Pietsch
2016-11-27 18:33:19 +01:00
committed by Jeremy Ruston
parent 3bceb98119
commit 766bc7acee
2 changed files with 29 additions and 1 deletions

View File

@@ -358,7 +358,8 @@ exports.getWeek = function(date) {
d = 7; // JavaScript Sun=0, ISO Sun=7
}
dt.setTime(dt.getTime() + (4 - d) * 86400000);// shift day to Thurs of same week to calculate weekNo
var n = Math.floor((dt.getTime()-new Date(dt.getFullYear(),0,1) + 3600000) / 86400000);
var x = new Date(dt.getFullYear(),0,1);
var n = Math.floor((dt.getTime() - x.getTime()) / 86400000);
return Math.floor(n / 7) + 1;
};