Files
beenvoice-app/lib/live-clock.ts
T
soconnor 14c880123c Add beenvoice mobile companion app with full dark mode support.
Expo app with dashboard, time clock, invoices, and settings — native tabs, glass UI, theme-aware components, and iOS Live Activities.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 22:36:37 -04:00

22 lines
488 B
TypeScript

import { useEffect, useState } from "react";
function formatClockTime(date: Date) {
return date.toLocaleTimeString(undefined, {
hour: "numeric",
minute: "2-digit",
});
}
export function useLiveClock() {
const [time, setTime] = useState(() => formatClockTime(new Date()));
useEffect(() => {
const tick = () => setTime(formatClockTime(new Date()));
tick();
const id = setInterval(tick, 15_000);
return () => clearInterval(id);
}, []);
return time;
}