If you make an advent calendar for someone in another country, a long-distance partner or a sister abroad, "door 5 opens on December 5" stops being a simple rule. December 5 starts at a different moment for you and for them.
I built a free digital advent calendar where you can fill all 24 doors yourself and send one link. Here's how I handled time zones, and the trade-off I accepted.
The goal
The person receiving the calendar should find a new note waiting when they wake up, in their own time zone, without anyone setting a time zone anywhere. No accounts, no settings page.
Two checks: one on the server, one in the browser
The server decides when a door's text is allowed to leave the database. It uses the earliest time zone on Earth (UTC+14), so nobody anywhere is ever kept waiting past their own midnight:
// A door unlocks when its day has started anywhere on Earth (UTC+14). export const unlockAt = (year, door) => Date.UTC(year, 11, door) - 14 * 3600 * 1000; When the calendar is loaded, the server only includes a note's text if now >= unlockAt(year, n). Locked doors come back as filled, without the note text.
The browser then adds the second check, using the device's own clock and time zone:
// Open only once it's that day where the reader is. const localOpen = (year, n) => Date.now() >= new Date(year, 11, n).getTime(); new Date(year, 11, n) is local midnight on December n for whoever is reading. A door shows as ready only when both checks pass. So someone in Tokyo and someone in Los Angeles each get door 5 at their own midnight, and neither has to tell the site where they live.
The trade-off
Because the server releases a door when the first time zone reaches that day, a determined recipient who already has the owner link could read the API response and see a note up to about 26 hours before their own midnight. I decided that was fine for a gift between people who trust each other. The alternative, asking for a time zone, adds a setting most people would get wrong or skip, and a sign-up I didn't want at all.
Gift mode: two links, two roles
When you fill the calendar yourself, the server creates two secrets:
- an edit key that stays with you, so you can keep adding notes to all 24 doors;
- an owner key that you send to the recipient, which is the link they open each day.
Only SHA-256 hashes of both keys are stored, never the keys themselves. Without the gift mode, friends fill doors through a shared link and each person can fill up to 3 doors; with it, you are the only writer by default, unless you also send friends the shared link.
What goes behind each door
Each door holds one text note of up to 280 characters plus a sticker. No photos or links, which keeps the stored data small and the privacy promise simple: everything is deleted on February 1.
That limit turned out to shape the content in a nice way. Instead of "here's a playlist", you write the song title and why it reminds you of them. Instead of a photo, one line describing it, to show them when you meet.
Wrapping up
The whole thing is two date comparisons and a choice about what "on time" means. If you're making one for someone far away this year, it's free and doesn't need an account: secretadvent.com. I'd be curious how others have handled "local midnight" without asking users for their time zone.
