fix bug periode
This commit is contained in:
@@ -209,7 +209,7 @@
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
minute: '2-digit',
|
||||
})}
|
||||
</span>
|
||||
</div>
|
||||
@@ -270,16 +270,6 @@
|
||||
.catch(error => {
|
||||
console.error('Error checking notifications:', error);
|
||||
});
|
||||
|
||||
const periode = document.getElementById('periode');
|
||||
const date = new Date();
|
||||
|
||||
const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
||||
const month = months[date.getMonth()]; // Get the current month's short name
|
||||
const nextMonth = months[(date.getMonth() + 1) % 12]; // Get the next month's short name, wrapping around if necessary
|
||||
const year = date.getFullYear();
|
||||
|
||||
periode.textContent = `${month} (11 ${month} - 10 ${nextMonth} ${year})`;
|
||||
</script>
|
||||
|
||||
<script>
|
||||
@@ -306,3 +296,30 @@
|
||||
|
||||
resetLogoutTimer();
|
||||
</script>
|
||||
|
||||
<script>
|
||||
const periode = document.getElementById('periode');
|
||||
const date = new Date();
|
||||
|
||||
const currentYear = date.getFullYear();
|
||||
const currentMonthIndex = date.getMonth(); // 0 = Jan, 11 = Dec
|
||||
const currentDay = date.getDate();
|
||||
const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
||||
|
||||
let startMonthIndex, closingMonthIndex, closingYear;
|
||||
|
||||
if (currentDay >= 11) {
|
||||
startMonthIndex = currentMonthIndex;
|
||||
closingMonthIndex = (currentMonthIndex + 1) % 12;
|
||||
closingYear = currentMonthIndex === 11 ? currentYear + 1 : currentYear;
|
||||
} else {
|
||||
startMonthIndex = (currentMonthIndex - 1 + 12) % 12;
|
||||
closingMonthIndex = currentMonthIndex;
|
||||
closingYear = currentYear;
|
||||
}
|
||||
|
||||
const startMonth = months[startMonthIndex];
|
||||
const closingMonth = months[closingMonthIndex];
|
||||
|
||||
periode.textContent = `${startMonth} (11 ${startMonth} - 10 ${closingMonth} ${closingYear})`;
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user