Commit 409419ae authored by Laura Lawniczak's avatar Laura Lawniczak
Browse files

WorkCycleData: Initialise weekEnd with weekStart to always get correct month

If weekEnd is initialised with the current date, the calculation breaks when a week
spans two months.
The new month will then be combined with the old months day, resulting in an additional
month added to weekEnd.
E.g. In a week starting on Monday, 30.07 weekEnd was calculated as (30.08 + 7days =  06.09)
from Wednesday on
parent 28ad7faf
......@@ -285,7 +285,7 @@ function generateWorkCircle(data, start, end, options = {}){
var dateNow = new Date();
var weekBegin = new Date(dateNow.getFullYear(), dateNow.getMonth(), dateNow.getDate() + (dateNow.getDay() == 0?-6:1)-dateNow.getDay());
var weekEnd = new Date();
var weekEnd = new Date(weekBegin);
weekEnd.setDate(weekBegin.getDate() + 7);
weekEnd.setHours(0,0,0,0);
generateWorkCircleHelper(data, options, weekBegin, weekEnd, "Woche", '#39539E');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment