added favicon and added timer to habits

This commit is contained in:
masongga
2026-05-24 10:22:46 -06:00
parent 532f604d94
commit 003ee3851e
5 changed files with 118 additions and 19 deletions

View File

@@ -17,3 +17,12 @@ export function getNextLocalMidnight(from = new Date()) {
export function getMillisecondsUntilLocalMidnight(from = new Date()) {
return Math.max(0, getNextLocalMidnight(from).getTime() - from.getTime());
}
export function formatCountdownDuration(milliseconds: number) {
const totalSeconds = Math.max(0, Math.floor(milliseconds / 1000));
const hours = Math.floor(totalSeconds / 3600);
const minutes = Math.floor((totalSeconds % 3600) / 60);
const seconds = totalSeconds % 60;
return `${hours}:${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}`;
}