If you build anything with a "you can't see this until December 12" rule, the first version usually hides it with CSS or a date check in the browser. Then someone opens DevTools and the surprise is gone.

TL;DR: decide on the server whether something is open, keep the content out of the HTML until it is, and store the time zone the rule was written in, not the viewer's.

I ran into this building an online advent calendar for friends: friends write short notes behind 24 doors, and the owner opens one door a day. Here is what ended up mattering.

1. Whose midnight?

"Door 12 opens on December 12" sounds simple until the owner is in Sydney and a friend fills a door from Los Angeles. I settled on one rule: the calendar's time zone is the owner's, captured once when the calendar is made. The browser sends Intl.DateTimeFormat().resolvedOptions().timeZone, the server validates it, and every later check uses that stored zone.

function todayIn(tz: string, now = new Date()): string { // "2026-12-12" in the calendar's zone return new Intl.DateTimeFormat("en-CA", { timeZone: tz }).format(now); } const isOpen = (door: number, tz: string) => todayIn(tz) >= `2026-12-${String(door).padStart(2, "0")}`; 

Comparing ISO date strings keeps it readable and avoids off-by-one hours around daylight saving.

2. Don't send what isn't open

The page renders on the server, so a closed door gets only what the owner is allowed to know: that it is filled, by whom, and the sticker. The note text never enters the HTML or the JSON. There is nothing to find in view-source, and no client code to bypass.

The same check runs on every write, too: friends can fill a door whose day has passed and the owner can read it right away, which also makes a calendar started on the 15th still useful.

3. Ownership without accounts

I didn't want sign-up for something people use for three weeks. Making a calendar creates a random key, stores only its SHA-256 hash, and puts the key in an httpOnly cookie for that calendar. A copy in localStorage lets the page claim the cookie back if it gets cleared, and an "owner link" with the key in the URL fragment (#k=..., which browsers never send to the server) moves it to another phone.

4. Small limits that prevent big problems

  • Each friend's browser can fill at most 3 doors per calendar.
  • Notes are capped at 200 characters.
  • Writes are rate limited per IP, and there is a report button.
  • Everything is deleted after January 31, which made the privacy page short.

The same engine, a different date rule

Once doors were just "spots with an opening date", a second version was cheap: a Christmas tree friends decorate where every ornament opens on Christmas Day. Same tables, one kind column, one different rule.

If you're building anything time-locked (capsules, reveals, scheduled answers), the short version: server decides, content stays out of the page until then, and the time zone belongs to whoever set the date.

Drafted with AI assistance and checked against the running code.