Every December, people search for a cafe or restaurant's hours and find last year's dates, a weekly timetable that ignores Christmas, or nothing. Many of them just go somewhere else.

This article covers the technical side of fixing that: how to store holiday hours so one source of truth drives both the text customers read and a live "Open now" badge. It works with any static page. You can use it whether you build the page yourself or hand it to someone else.

Start with a list of dates, not a sentence

"Reduced hours over the holidays" tells a customer nothing. Before you write any code, write down every day from about 20 December to 3 January and give each one of three states:

  • Normal: the usual weekly hours apply.
  • Changed: different opening and closing times, such as closing at 14:00 on Christmas Eve.
  • Closed: closed all day.

Write each date with its weekday, for example "Thu 24 Dec". People plan by weekday. Writing it yourself also catches mistakes like assuming the 26th is a Saturday when it isn't.

Also note the first normal day back. A customer who sees a long run of "Closed" wants to know when you reopen.

Store hours as weekly rules plus date exceptions

The usual mistake is a single weekly table. A weekly table can't express "closed on the 25th." Keep the normal week and the exceptions separate. When a date appears in the exceptions, its entry overrides the weekly rule.

const hours = { timeZone: "Europe/London", weekly: { mon: [["08:00", "17:00"]], tue: [["08:00", "17:00"]], wed: [["08:00", "17:00"]], thu: [["08:00", "17:00"]], fri: [["08:00", "21:00"]], sat: [["09:00", "21:00"]], sun: [] // closed every Sunday }, exceptions: { "2026-12-24": [["08:00", "14:00"]], "2026-12-25": [], // empty array = closed all day "2026-12-26": [], "2026-12-31": [["08:00", "16:00"]], "2027-01-01": [] } }; 

Two details matter here:

  • An empty array means closed. Check whether a date key exists, not whether its value is truthy. Otherwise a closed day falls back to the weekly hours.
  • Each day holds a list of time ranges, so a split shift such as lunch and dinner with a break is just two pairs.

Compute "Open now" in the venue's time zone

If you use the visitor's local clock, the badge is wrong for anyone browsing from another time zone. It is also wrong for anyone whose device clock is off. Convert the current moment into the venue's time zone first:

function venueNow(tz, date = new Date()) { const f = new Intl.DateTimeFormat("en-CA", { timeZone: tz, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", weekday: "short", hourCycle: "h23" }); const p = Object.fromEntries(f.formatToParts(date).map(x => [x.type, x.value])); return { iso: `${p.year}-${p.month}-${p.day}`, day: p.weekday.toLowerCase().slice(0, 3), time: `${p.hour}:${p.minute}` }; } function isOpenNow(h, date = new Date()) { const { iso, day, time } = venueNow(h.timeZone, date); const slots = iso in h.exceptions ? h.exceptions[iso] : h.weekly[day]; return slots.some(([open, close]) => time >= open && time < close); } 

Zero-padded "HH:MM" strings compare correctly as text, so you don't need date arithmetic. hourCycle: "h23" prevents midnight from showing up as "24:00".

If you close after midnight, split the range across two days, for example ["18:00", "23:59"] on Friday and ["00:00", "01:00"] on Saturday. Then the comparison logic stays simple.

Re-run the check every minute with setInterval. That way a page left open in a browser tab flips from "Open" to "Closed" at 14:00 on Christmas Eve without a reload.

Render the visible list from the same data

Don't type the holiday hours a second time in your HTML. Loop over the date range and print each day from the same object. Then the badge and the list can never disagree. Show "Closed" in words, not as a blank cell. Show today's line in bold so a visitor doesn't have to work out the date.

Tell search engines and map listings too

Search results and map apps often show hours before anyone reaches your page. schema.org has a property made for this, specialOpeningHoursSpecification. You can generate it from the same exceptions:

{ "@context": "https://schema.org", "@type": "CafeOrCoffeeShop", "name": "Example Cafe", "specialOpeningHoursSpecification": [ { "@type": "OpeningHoursSpecification", "validFrom": "2026-12-24", "validThrough": "2026-12-24", "opens": "08:00", "closes": "14:00" }, { "@type": "OpeningHoursSpecification", "validFrom": "2026-12-25", "validThrough": "2026-12-26", "opens": "00:00", "closes": "00:00" } ] } 

By schema.org convention, opens and closes both set to 00:00 means closed. Structured data doesn't replace updating your business listings directly, so do both.

Keep the phone number and directions one tap away

Holiday visitors are often on a phone and in a hurry. Near the hours, add:

  • <a href="tel:+441234567890">Call us</a>, using the full international number.
  • A directions link to your full street address, so a tap opens the visitor's own map app.

If the hours confuse someone, a phone call is their fallback. Don't hide it in the footer.

Test before December, not during it

isOpenNow accepts a date, so you can check edge cases directly:

isOpenNow(hours, new Date("2026-12-24T13:59:00Z")); // true in London isOpenNow(hours, new Date("2026-12-24T14:00:00Z")); // false isOpenNow(hours, new Date("2026-12-25T10:00:00Z")); // false 

Also check these:

  • A normal Sunday shows closed.
  • 2 January falls back to weekly hours.
  • The page reads correctly on a small phone screen.
  • Remove the expired exceptions in January, or ignore past dates automatically when you render the list.

A shortcut if you'd rather not build it

Everything above takes an afternoon if you're comfortable with HTML and JavaScript. If you run the cafe and don't have that afternoon, Automaton offers a one-page website for a small place for $99. It includes photos, opening hours with a live "Open now", a map with directions, and holiday hours. You email your address and hours, see a free preview of your own site, and pay only if you want to keep it. To have it live before December, the order-by date is Monday 30 November.

This article was written with AI (Claude) for Automaton.