abbreviate Wednesday; more titlecase

This commit is contained in:
Mark Eaton
2021-03-29 10:20:38 -04:00
parent be980f152c
commit 3755276f22
2 changed files with 9 additions and 3 deletions
+8 -2
View File
@@ -367,6 +367,12 @@ window.onload = function () {
for (var i = 0; i < h.length; i++) { for (var i = 0; i < h.length; i++) {
let targetDate = new Date(h[i].Date + "T00:00:00.000-05:00"); let targetDate = new Date(h[i].Date + "T00:00:00.000-05:00");
let today = new Date(); let today = new Date();
if (targetDate.toLocaleDateString("en-US", options_weekday) === "Wednesday") {
weekday = "Wed"
} else {
weekday = targetDate.toLocaleDateString("en-US", options_weekday)
}
console.log(weekday);
if (targetDate.getFullYear() === today.getFullYear() && if (targetDate.getFullYear() === today.getFullYear() &&
targetDate.getMonth() === today.getMonth() && targetDate.getMonth() === today.getMonth() &&
targetDate.getDate() === today.getDate()) { targetDate.getDate() === today.getDate()) {
@@ -374,10 +380,10 @@ window.onload = function () {
var start = true; var start = true;
var count = 1; var count = 1;
} else if (start === true && count < 3 && h[i].Hours === "Closed" ) { } else if (start === true && count < 3 && h[i].Hours === "Closed" ) {
document.getElementById('hours' + count).innerHTML = "<span style='color:#666;'><p>" + targetDate.toLocaleDateString("en-US", options_weekday) + "<br />" + targetDate.toLocaleDateString("en-US", options_date) + "<br />" + h[i].Hours + "</p></span>"; document.getElementById('hours' + count).innerHTML = "<span style='color:#666;'><p>" + weekday + "<br />" + targetDate.toLocaleDateString("en-US", options_date) + "<br />" + h[i].Hours + "</p></span>";
count++; count++;
} else if (start === true && count < 3 && h[i].Hours != "Closed") { } else if (start === true && count < 3 && h[i].Hours != "Closed") {
document.getElementById('hours' + count).innerHTML = "<p>" + targetDate.toLocaleDateString("en-US", options_weekday) + "<br />" + targetDate.toLocaleDateString("en-US", options_date) + "<br />" + h[i].Hours + "</p>"; document.getElementById('hours' + count).innerHTML = "<p>" + weekday + "<br />" + targetDate.toLocaleDateString("en-US", options_date) + "<br />" + h[i].Hours + "</p>";
count++; count++;
} }
} }
@@ -5,7 +5,7 @@
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
<div id="corona-alert"> <div id="corona-alert">
<a id="corona-alert-text" href="https://kbcc.cuny.libguides.com/coronavirus/home">Alert! Library services during COVID-19</a> <a id="corona-alert-text" href="https://kbcc.cuny.libguides.com/coronavirus/home">Alert! Library Services During COVID-19</a>
</div> </div>
</div> </div>
</div> </div>