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

fix for 2634 problems with week calculation

This commit is contained in:
Mario Pietsch
2016-11-14 00:56:18 +01:00
parent 0c6b2311ae
commit b43b89f44a
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;
};