This is a basic streak counter - inspired by Duolingo,
and made following Joe Previte's course -
written in TypeScript and meant for the browser (uses localStorage
).
yarn add @sazed/streak-counter
import { streakCounter } from '@sazed/streak-counter';
const today = new Date();
const streak = streakCounter(localStorage, today);
streak returns an object:
{
currentCount: 1,
lastLoginDate: "01/24/2023",
startDate: "01/24/2023",
}