Business hours on website

Hello
I use javascript function to display my opening hours, on my website.
Can the word closed also be displayed there outside these times?
see code below

var dayOfWeek = (new Date).getDay();
var hours = [“Gesloten”, // Sunday
“07:00 tot 17:30 uur”, // Monday
“07:00 tot 17:30 uur”, // Tuesday
“07:00 tot 14:00 uur”, // Wednesday
“07:00 tot 17:30 uur”, // Thursday
“07:00 tot 17:30 uur”, // Friday
“07:00 tot 16:00 uur”]; // Saturday
var todaysHours = hours[dayOfWeek];
document.getElementById(“hours”).innerHTML = todaysHours;

Welcome to this forum.

Surely visitors to your website are going to want to know all your weekly opening hours.

To me your existing JavaScript does not make sense. So for example after 16:00 on Saturday it will display “07:00 tot 16:00 uur” which is not helpful. In contrast Google search side panel would show “Closed ⋅ Opens 7AM Monday”.

I therefore suggest you display all your opening hours and then use JavaScript to display whether the business is currently closed or open, perhaps like Google including when the business next opens or closes.

and how can i do that?

This JavaScript needs checking:

thanks , i am go try

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.