Hotfix: Monatswechsel (Denkfehler)

hotfix
Samuel Zielke 9 months ago
parent 53638bdc37
commit 74c7e935de

@ -6,8 +6,6 @@ const SETStudySaveButton = document.getElementById('SETStudySaveButton')
const SETMonthGoalSaveButton = document.getElementById('SETMonthGoalSaveButton') const SETMonthGoalSaveButton = document.getElementById('SETMonthGoalSaveButton')
var allowToSend = false; var allowToSend = false;
const monate = ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"]; const monate = ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"];
const aktuellerMonat = monate[new Date().getMonth()];
// Aktuelles Datum
const currentDate = new Date(); const currentDate = new Date();
@ -162,7 +160,8 @@ async function getActualDataAndFillView(monat = currentDate.getMonth(), jahr = c
// Einfüfen des aktuellen Monats // Einfüfen des aktuellen Monats
document.getElementById('actualMonthName').innerHTML = monate[monat !== 12 ? monat : 0]; document.getElementById('actualMonthName').innerHTML = monate[monat !== 12 ? monat : 0];
console.log(monat) console.log("AKTUELLER MONAT SYSTEM: ", monat)
console.log("AKTUELLER MONAT REAL: ", currentDate.getMonth())
// Settings vor ausfüllen // Settings vor ausfüllen
@ -387,27 +386,31 @@ document.getElementById('dashbord_month_area').addEventListener('click', () =>{
}) })
document.getElementById('btn-month-before').addEventListener('click', () =>{ document.getElementById('btn-month-before').addEventListener('click', () =>{
// console.log(diffMonth) console.log("CLICK-BEFORE: ", diffMonth)
if (diffMonth === 0) { if (new Date().getMonth() + diffMonth == 0) {
diffMonth = 11; diffMonth = 11 - new Date().getMonth();
getActualDataAndFillView(new Date().getMonth() + diffMonth) getActualDataAndFillView(new Date().getMonth() + diffMonth)
console.log("CLICK-BEFRORE-0TO11: ", diffMonth)
} else { } else {
diffMonth = ((monate[new Date().getMonth() + diffMonth]) != 'September') ? diffMonth - 1 : diffMonth; diffMonth = ((monate[new Date().getMonth() + diffMonth]) != 'September') ? diffMonth - 1 : diffMonth;
// document.getElementById('actualMonthName').innerHTML = monate[new Date().getMonth() + diffMonth]; // document.getElementById('actualMonthName').innerHTML = monate[new Date().getMonth() + diffMonth];
getActualDataAndFillView(new Date().getMonth() + diffMonth) getActualDataAndFillView(new Date().getMonth() + diffMonth)
}; };
// console.log(diffMonth) console.log("CLICK-BEFORE-AFTER: ", diffMonth)
}); });
document.getElementById('btn-month-next').addEventListener('click', () =>{ document.getElementById('btn-month-next').addEventListener('click', () =>{
if (diffMonth === 11) { console.log("CLICK-NEXT: ", diffMonth)
diffMonth = 0; if (new Date().getMonth() + diffMonth == 11) {
diffMonth = 0 - new Date().getMonth();
getActualDataAndFillView(new Date().getMonth() + diffMonth) getActualDataAndFillView(new Date().getMonth() + diffMonth)
console.log("CLICK-NEXT-11TO0: ", diffMonth)
} else { } else {
diffMonth = ((monate[new Date().getMonth() + diffMonth]) != 'August') ? diffMonth + 1 : diffMonth; diffMonth = ((monate[new Date().getMonth() + diffMonth]) != 'August') ? diffMonth + 1 : diffMonth;
// document.getElementById('actualMonthName').innerHTML = monate[new Date().getMonth() + diffMonth]; // document.getElementById('actualMonthName').innerHTML = monate[new Date().getMonth() + diffMonth];
getActualDataAndFillView(new Date().getMonth() + diffMonth) getActualDataAndFillView(new Date().getMonth() + diffMonth)
}; };
console.log("CLICK-NEXT-AFTER: ", diffMonth)
}) })
function setNewCalsOfMonth(TheMonth) { function setNewCalsOfMonth(TheMonth) {

Loading…
Cancel
Save

Powered by TurnKey Linux.