Im trying to have my store hours posted aswell as a displaying of open or closed + closing soon and the website seems to be an hour behind i just dont know why it closes at 7 instead of 6 on the and sometimes it closses at 11 instead of 10 on the website.
function isStoreOpen() {
const now = new Date();
const offset = -4; // Eastern Time offset (UTC-4 during standard time)
const easternTime = new Date(now.getTime() + offset * 3600000); // Convert to Eastern Time
const day = easternTime.getUTCDay();
const hour = easternTime.getUTCHours();
if (day === 0) { // Sunday
return hour >= 10.5 && hour <= 18;
} else if (day === 6) { // Saturday
return hour >= 10.5 && hour <= 23;
} else if (day === 3) { // Wednesday
return hour >= 10.5 && hour <= 21; // Adjusted closing time to 9 PM
} else { // Monday, Tuesday, Thursday, Friday
return hour >= 10.5 && hour <= 22;
}
}
document.addEventListener('DOMContentLoaded', function() {
const storeStatusElement = document.getElementById('store-status');
const isOpen = isStoreOpen();
if (isOpen) {
storeStatusElement.textContent = 'Open';
storeStatusElement.style.color = 'maroon';
} else {
storeStatusElement.textContent = 'Closed';
storeStatusElement.style.color = 'maroon';
}
});
/* Your CSS styles here */
.store-container {
text-align: left;
display: flex;
align-items: flex-start;
margin-left: 0;
}
.store-hours {
text-align: left;
flex: 1;
}
.store-hours ul {
list-style: none;
padding: 0;
}
.banquet-container {
background-color: #f7f7f7;
padding: 20px;
border: 2px solid maroon;
width: 52%;
margin-left: 40px;
}
.banquet-container h2 {
color: maroon;
}
.banquet-container p {
color: maroon;
}
#store-status {
font-weight: bold;
}
@media (max-width: 768px) {
.store-container {
flex-direction: column;
}
.banquet-container {
width: 100%;
margin-left: 0;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div class="store-container">
<div class="store-hours">
<p><strong>Store Hours:</strong></p>
<ul>
<li><span class="day">Sunday:</span> 10:30 AM - 6:00 PM</li>
<li><span class="day">Monday:</span> 11:00 AM - 10:00 PM</li>
<li><span class="day">Tuesday:</span> 11:00 AM - 10:00 PM</li>
<li><span class="day">Wednesday:</span> 11:00 AM - 10:00 PM</li>
<li><span class="day">Thursday:</span> 11:00 AM - 10:00 PM</li>
<li><span class="day">Friday:</span> 11:00 AM - 11:00 PM</li>
<li><span class="day">Saturday:</span> 11:00 AM - 11:00 PM</li>
</ul>
<p><strong>Store Status:</strong> <span id="store-status"></span></p>
</div>
<div class="banquet-container">
<h2>Banquet Room</h2>
<p>Lock 9 is pleased to offer a banquet space perfectly suited for hosting class reunions. Whether you're reconnecting with old friends or reminiscing about the good times, our banquet facility provides an ideal setting to bring your classmates together. With its spacious layout, the space comfortably accommodates gatherings of varying sizes. Our dedicated team ensures your reunion is a memorable experience, handling everything from setup to catering with attention. Choose Lock 9's banquet space to create a warm and nostalgic atmosphere where cherished memories can be relived and new ones can be made.</p>
</div>
</div>
</body>
</html>
i tried implementing php into the site and its not working