The CSS
/* ***** This is the highlight color */
.current-day {
background-color: rgb(249,249,214);
}
Minified version of CSS
.current-day{background-color:rgb(249,249,214)}
The JavaScript
// ***** Goes by the listing timezone
function binaryGetCurrentDayInTimeZone(timeZone) {
const now = new Date();
const options = {
weekday: 'long',
timeZone: timeZone
};
return new Intl.DateTimeFormat('en-US', options).format(now);
}
function binaryHighlightCurrentDay() {
const timeZoneElement = document.querySelector('.ts-timezone');
const timeZone = timeZoneElement ? timeZoneElement.textContent.split(': ')[1] : 'UTC';
const currentDay = binaryGetCurrentDayInTimeZone(timeZone);
const dayElements = document.querySelectorAll('.ts-day');
dayElements.forEach(function(dayElement) {
if (dayElement.textContent === currentDay) {
dayElement.closest('li').classList.add('current-day');
}
});
}
document.addEventListener('DOMContentLoaded', function() {
binaryHighlightCurrentDay();
});
Minified version of JavaScript
function binaryGetCurrentDayInTimeZone(timeZone){const now=new Date();const options={weekday:'long',timeZone:timeZone};return new Intl.DateTimeFormat('en-US',options).format(now)}
function binaryHighlightCurrentDay(){const timeZoneElement=document.querySelector('.ts-timezone');const timeZone=timeZoneElement?timeZoneElement.textContent.split(': ')[1]:'UTC';const currentDay=binaryGetCurrentDayInTimeZone(timeZone);const dayElements=document.querySelectorAll('.ts-day');dayElements.forEach(function(dayElement){if(dayElement.textContent===currentDay){dayElement.closest('li').classList.add('current-day')}})}
document.addEventListener('DOMContentLoaded',function(){binaryHighlightCurrentDay()})