Merge pull request #12 from Huguet57/patch-6
Independence of time
diff --git a/js/limit-years.js b/js/limit-years.js
index 41647f7..76447c0 100644
--- a/js/limit-years.js
+++ b/js/limit-years.js
@@ -55,9 +55,16 @@
}
}
+function first_day(year) {
+ start_course = new Date(year + '-09-12');
+ return start_course;
+}
+
function addYearList() {
var ylistspan = document.querySelector("#year-list-span")
- for(var year = 2006; year < 2019; year++) {
+ var year = 2007;
+ var today = new Date();
+ while (first_day(year) < today) {
var lab = document.createElement("label");
lab.setAttribute("class", "mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect custom-checkbox");
lab.setAttribute("for", "checkbox-"+year);
@@ -90,6 +97,7 @@
lab.appendChild(span);
ylistspan.appendChild(lab);
ylistspan.insertAdjacentHTML("beforeend", "<br>");
+ ++year;
}
document.querySelector("#settings").addEventListener("click", altYearList);