Wochentag berechnen korrektur für Jahr das am Mittwoch startet
This commit is contained in:
parent
cd59aa0546
commit
898708b37c
7
app.js
7
app.js
|
@ -202,8 +202,10 @@ function getdayOfWeek(week, year) {
|
||||||
const firstDayOfYear = new Date(year, 0, 1);
|
const firstDayOfYear = new Date(year, 0, 1);
|
||||||
const dayOfWeek = firstDayOfYear.getDay();
|
const dayOfWeek = firstDayOfYear.getDay();
|
||||||
const daysUntilFirstThursday =
|
const daysUntilFirstThursday =
|
||||||
dayOfWeek <= weekday ? weekday - dayOfWeek : 11 - dayOfWeek;
|
dayOfWeek <= weekday ? weekday - dayOfWeek : weekday + 7 - dayOfWeek;
|
||||||
const daysUntilThursdayOfWeek = (week - 1) * 7 + daysUntilFirstThursday;
|
const weekcorrekt = daysUntilFirstThursday >= dayOfWeek ? 2 : 1;
|
||||||
|
const daysUntilThursdayOfWeek =
|
||||||
|
(week - weekcorrekt) * 7 + daysUntilFirstThursday;
|
||||||
const thursdayOfWeek = new Date(year, 0, 1 + daysUntilThursdayOfWeek);
|
const thursdayOfWeek = new Date(year, 0, 1 + daysUntilThursdayOfWeek);
|
||||||
return thursdayOfWeek;
|
return thursdayOfWeek;
|
||||||
}
|
}
|
||||||
|
@ -789,6 +791,7 @@ ORDER BY r.riegennummer, t.geburtsdatum ASC;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
if (training) {
|
if (training) {
|
||||||
|
console.log("THIS!");
|
||||||
training.datum = getdayOfWeek(training.kw, training.jahr);
|
training.datum = getdayOfWeek(training.kw, training.jahr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue