JavaScriptのタイマーで

以前教えていただいたJavaScriptのタイマー機能で質問なのですが、
現在

2023年7月1日 10:00 こちらの時間を参照して、時間が過ぎたら応募ボタンを応募終了しました に変更できたのですが、

下記のようなspanタグで、かつ年度の記述が変わった場合の
JavaScriptの修正方法が分からず・・
<span id="myDate">2023年7月1日~7月2日 10:00</span>

どこを修正すればいよいか、ぜひご教授いただけないでしょうか?

該当のソースコード

window.onload = function () { var d = new XMLHttpRequest(); d.open("HEAD", window.location.href, true); d.send(); d.onreadystatechange = function () { if (this.readyState === 4) { var g = new Date(d.getResponseHeader("Date")) } }; var c = new Date(); var f = new Date("1989/01/01 12:00:00"); const e = document.getElementById("myDate").textContent; const a = set = new Date(e.replace(/&#24180;|&#26376;/g, "/").replace("&#26085;", "").replace(/&#65288;.+&#65289;/, " ").replace(/\(.+\)/, " ").replace(/(\d+\:\d+)/, "$1:00")); var b = document.querySelectorAll(".timeLimitedScript"); if (f < c && c < a) { for (i = 0; i < b.length; i++) { b[i].style.display = "inline-block" } } if (f < c && c < a) { document.getElementById("timeLimitedScript2").innerHTML = "<!-- -->" } else { document.getElementById("timeLimitedScript2").getElementsByTagName('p')[0].innerHTML = "&#24540;&#21215;&#32066;&#20102;&#12375;&#12414;&#12375;&#12383;" } }; 応募期限 2023年7月1日 10:00

コメントを投稿

0 コメント