An advent calendar looks simple: one door per day. Making it behave well for every kind of player is not. Somebody installs on December 17th. Somebody travels across time zones. Somebody forgets for a week. This is how the winter puzzle calendar in our app Snowlings handles all of it with a small, pure piece of date logic and no server.
The year is cut into four phases
The calendar screen depends only on today's date, and the date maps to one of four phases. November is a preview, with a single practice door, so the app is not empty before the season. December is the advent proper: one new door every day. January and February are winter mode, where every door stays open and can be replayed. From March to October the app is quiet.
A small detail with a big effect is the season year. January to October belong to the previous December's season, so the decorated tree is still there in the spring, and only November starts a new season. Progress is stored per season year and per door, so a new December starts from empty doors without touching last year's stars.
Which door is open
During the advent the rule is a single comparison: a door is open when its number is not greater than today's day of the month. In winter and quiet months all doors are open. In the November preview only the practice door is open. Because the function takes a date and returns an answer, it is trivial to test with any date, including the awkward ones.
Missed doors without a punishment
A door from an earlier December day that was never solved counts as missed. To open it, the player watches a short ad or spends snowflakes earned in free play, and the choice is stored as an unlocked flag for that season and day, so the door never asks twice.
There is one rule that matters for fairness. If the player installs in December, every door before the installation day is simply open. Somebody who arrives on December 17th should not meet an ad wall on sixteen doors. The app records the installation date once, and the missed check compares against it.
Time zones and the midnight timer
Today is computed from the phone clock and the phone time zone, converted to a local calendar date. The countdown to the next door asks for the milliseconds until the next local midnight, which is the start of the following local day in the current time zone. The New Year countdown works the same way, aimed at January 1st at local midnight.
The same idea gives a fun screen at midnight: a list of cities that have already entered the new year, built from fixed standard-time offsets in minutes for each city. The offsets are the December ones, so the list does not depend on any online service.
A difficulty curve you can read in one function
Each door maps to a game and a difficulty with one function. The six games rotate through the days, so the same game returns every sixth door. Days one to three start at level one, days four to seven at level two, days eight to twenty-one climb from three to five, and the last stretch before the end goes up to seven and eight. Day twenty-four and day twenty-five are large picture puzzles, and day thirty-one is the finale that puts the star on the tree.
Keeping this in one pure function means that balance changes are a one-line edit, and that every player sees the same door on the same day.
Honest limits
There is no server, so the app trusts the phone clock. A phone set to a wrong date shows a wrong door. For a free puzzle calendar we accepted that: a local, offline-first app that works on a plane is worth more to us than a strict clock. If your calendar has prizes, you need a different design.
FAQ
Does the calendar need an internet connection?
No. The date logic runs on the device, so the doors work offline.
What happens to doors a player missed?
They can be opened later with a short ad or with snowflakes earned in free play, and the unlock is remembered.
What if someone installs in the middle of December?
All doors before the installation day are open, so a late start never meets an ad wall.
Can changing the phone date open doors early?
Yes. The app reads the phone clock and has no server to check it, which we accept for a casual puzzle calendar.
If you want to see this in action, Snowlings is free on Google Play and needs no account. More notes like this one live on my site.
Top comments (0)