Skip to content
Full-Stack Developer

Notes/Node.js

The server clock is not the user's day

2026-02-04

A wellness “today” that follows the API server will check people in on the wrong calendar day the moment they are not in the same timezone as the box. NIWA stores IANA timezones and UTC timestamps. Check-in dates and cron windows are computed in the user timezone. Node and Postgres stay on UTC. Reminders, badges, and tiers also have to survive more than one API instance. Nest cron plus a Postgres advisory lock means only one instance runs each job. Without the lock you get duplicate pushes and duplicate tier writes. Community identity is a different clock problem: peers must never see email or legal name. Public handles come from a word-pair dictionary; membership and votes use user id only on the server.