Files
IncomeTaxSystem/static/js/year_dropdown.js

24 lines
540 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
document.addEventListener("DOMContentLoaded", function () {
const yearDropdown = document.getElementById("year");
const currentYear = new Date().getFullYear();
const startYear = 1990;
for (let y = currentYear; y >= startYear; y--) {
let nextYear = y + 1;
let option = document.createElement("option");
// Backend receives only first year (example 2024)
option.value = y;
// User sees (example AY 20242025)
option.textContent = `AY ${y}-${nextYear}`;
yearDropdown.appendChild(option);
}
});