add correct date format
This commit is contained in:
+10
-6
@@ -31,10 +31,10 @@ function getNextUpdateDate() {
|
|||||||
const currentMonth = now.getMonth();
|
const currentMonth = now.getMonth();
|
||||||
const currentYear = now.getFullYear();
|
const currentYear = now.getFullYear();
|
||||||
const today = now.getDate();
|
const today = now.getDate();
|
||||||
|
|
||||||
let updateMonth = currentMonth;
|
let updateMonth = currentMonth;
|
||||||
let updateYear = currentYear;
|
let updateYear = currentYear;
|
||||||
|
|
||||||
if (today > 28) {
|
if (today > 28) {
|
||||||
updateMonth++;
|
updateMonth++;
|
||||||
if (updateMonth > 11) {
|
if (updateMonth > 11) {
|
||||||
@@ -42,15 +42,19 @@ function getNextUpdateDate() {
|
|||||||
updateYear++;
|
updateYear++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
const updateDate = new Date(updateYear, updateMonth, 28);
|
||||||
return `${monthNames[updateMonth]} ${updateYear}`;
|
const yyyy = updateDate.getFullYear();
|
||||||
|
const mm = String(updateDate.getMonth() + 1).padStart(2, '0');
|
||||||
|
const dd = String(updateDate.getDate()).padStart(2, '0');
|
||||||
|
|
||||||
|
return `${yyyy}-${mm}-${dd}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateNavbarUpdateDate() {
|
function updateNavbarUpdateDate() {
|
||||||
const container = document.getElementById('update-date-display');
|
const container = document.getElementById('update-date-display');
|
||||||
if (container) {
|
if (container) {
|
||||||
container.textContent = `Next update: ${getNextUpdateDate()} 28`;
|
container.textContent = `Next update: ${getNextUpdateDate()}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user