_includes/segment/index.html in askclass-course-theme-0.7.2 vs _includes/segment/index.html in askclass-course-theme-0.7.3

- old
+ new

@@ -47,12 +47,15 @@ {%- endfor -%} </ul> <script defer> const due = document.querySelectorAll('.alarm'); - due.forEach( el => { - const d = new Date(el.dataset.date.split('-')).getTime(); - if (d < Date.now()) { - el.parentNode.removeChild(el); - } - }); + const ymd2ms = d => { + const ymd = d.split('-'); + ymd[1]--; + return new Date(...ymd).getTime(); + }; + due.forEach( el => + ymd2ms(el.dataset.date) < Date.now() && + el.parentNode.removeChild(el) + ); </script>