← Back

PROJECT 004 · 2026 · JS · LOCALSTORAGE

Ritual

Live ↗Code ↗

Summary

A habit tracker: add daily habits, tick them off and see today's progress. Every new day, habits reset by themselves.

Why I built it

After Journalist I wanted to rebuild the basics in a smaller, cleaner project: state, rendering from data, events and localStorage.

How it works

Ritual: reset logicOn load: today = getTodayDate(). If (lastResetDate ≠ today): all habits get done = false, then today is saved. Then render: "Completed today: x / y".on loadtoday = getTodayDate()if (lastResetDate ≠ today)yesnoall habits: done = falsesave todayrender"Completed today: x / y"
FIG. 1 — Reset logicNTS

Hard parts

  • A daily reset that never deletes habits, only their status.
  • The whole UI rendered from one array. Change the data, render again.

Known issue

getTodayDate() uses toISOString(), which is UTC time. In Poland habits reset at 1:00 at night (2:00 in summer), not at midnight. The fix is to build the date from local time.

What I learned

Small projects are the best place to train fundamentals. Render the UI from the data, never the other way round.