Newer
Older
M.Modal.init(document.getElementById("modalDate"), {
$("#global-datepicker-previous").click(function()
{
updateYearGrid(-11, document.getElementById('currentYear').innerHTML);
});
$("#global-datepicker-next").click(function()
{
updateYearGrid(11, document.getElementById('currentYear').innerHTML);
});
$("#global-datepicker-select-year .global-datepicker-item").click(function()
{
selectYear(this.innerText);
});
$("#global-datepicker-select-month .global-datepicker-item").click(function()
{
selectMonth($("#global-datepicker-select-month .global-datepicker-item").index(this) + 1);
});
});
var year;
year = undefined;
$("#global-datepicker-select-month").hide();
$("#global-datepicker-select-year").show();
function updateYearGrid(modifier, currentYear)
{
$("#global-datepicker-select-year").fadeOut(200, function()
{
var items = $("#global-datepicker-select-year .global-datepicker-item");
var firstYear = parseInt(items[0].innerText);
var newFirstYear = firstYear + modifier;
items[i].classList.add("global-datepicker-selected");
items[i].classList.remove("global-datepicker-selected");
}
$("#global-datepicker-select-year").fadeIn(200);
});
$("#global-datepicker-select-year").fadeOut(200, function()
{
$("#global-datepicker-select-month").fadeIn(200);
});
var dateString = "01." + selectedMonth + "." + year;
document.cookie = "currentDate=" + dateString;
document.getElementById('buttonChooseDate').click();
}