Menu

1 / 5

How an Advent Calendar App Decides Which Door Opens Today

DEV Community: kotlin·Nesim Razon·about 11 hours ago
#F578sxan
#devtokotlin#devto#dev#door#date
Reading 0:00
15s threshold

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.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.