improve handling of weekdays at small screen sizes
This commit is contained in:
@@ -363,16 +363,16 @@ a.no-underline {
|
|||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
const h = JSON.parse(hours);
|
const h = JSON.parse(hours);
|
||||||
const options_weekday = { weekday: 'long' };
|
const options_weekday = { weekday: 'long' };
|
||||||
|
const options_weekday_short = { weekday: 'short' };
|
||||||
const options_date = { month: 'short', day: 'numeric' };
|
const options_date = { month: 'short', day: 'numeric' };
|
||||||
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") {
|
if (window.innerWidth < 500) {
|
||||||
weekday = "Wed"
|
weekday = targetDate.toLocaleDateString("en-US", options_weekday_short)
|
||||||
} else {
|
} else {
|
||||||
weekday = targetDate.toLocaleDateString("en-US", options_weekday)
|
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()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user