Live demo, open source
Daily streaks that stay correct across time zones and DST
Move the clock, skip days, fly across zones and cross daylight saving changes. Every streak, level, quest and rank on this page is computed in your browser by the library's own code from src/.
Zero dependencies JavaScript and PHP 217 shared test vectors
Try a scenario
User's clock
Move time
Act
Settings
Streak
Level
Quests
Weekly leaderboard
What happened
Last library call
The exact input and output of the most recent call, straight from the library.
Use it
Load the state you store, call a function, save the state it returns. Instants are integer Unix seconds and zones are IANA names.
npm install github:moonetix/gamification-kit
import { checkIn } from 'gamification-kit';
const { state, result } = checkIn(saved, {
at: Math.floor(Date.now() / 1000),
timeZone: 'America/New_York',
});
A PHP port with the same option names and the same test vectors lives in php/. Use these mechanics for XP, levels and badges, not for currency that has money-like value.