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 dayOfWeek = firstDayOfYear.getDay();
|
||||
const daysUntilFirstThursday =
|
||||
dayOfWeek <= weekday ? weekday - dayOfWeek : 11 - dayOfWeek;
|
||||
const daysUntilThursdayOfWeek = (week - 1) * 7 + daysUntilFirstThursday;
|
||||
dayOfWeek <= weekday ? weekday - dayOfWeek : weekday + 7 - dayOfWeek;
|
||||
const weekcorrekt = daysUntilFirstThursday >= dayOfWeek ? 2 : 1;
|
||||
const daysUntilThursdayOfWeek =
|
||||
(week - weekcorrekt) * 7 + daysUntilFirstThursday;
|
||||
const thursdayOfWeek = new Date(year, 0, 1 + daysUntilThursdayOfWeek);
|
||||
return thursdayOfWeek;
|
||||
}
|
||||
|
@ -789,6 +791,7 @@ ORDER BY r.riegennummer, t.geburtsdatum ASC;
|
|||
});
|
||||
});
|
||||
if (training) {
|
||||
console.log("THIS!");
|
||||
training.datum = getdayOfWeek(training.kw, training.jahr);
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue