pota/use/timeClock formatters, useTimeout for auto-disposing timers, useElapsed
for relative-time readers that re-render on unit boundaries, and
useStopwatch for start/stop/reset counters.
now() — Date.now()date(ts?) — YYYY-MM-DDdatetime(ts?) — YYYY-MM-DD HH:MMtime(ts?) — HH:MM (documented below)timeWithSeconds(ts?) — HH:MM:SSday(ts?, lang?) — locale-aware weekday + datemeasure(name, cb, report?) — run cb,
reporting its timetiming(fn) — milliseconds fn tookuseTimeout(cb, delay, ...args) —
auto-disposing, reactive-delay timeruseElapsed(timestamp) — relative time
without per-second rendersuseStopwatch(opts?) — start / stop /
reset countertime(timestamp = now()) formats a timestamp as HH:MM. The other
clock formatters are date,
datetime,
timeWithSeconds, and
day; all default to now().
Renders the current HH:MM clock. Pass a timestamp to format any
other moment.
import { render } from 'pota'
import { time } from 'pota/use/time'
function App() {
return <p>It is {time()}</p> // e.g. '14:25'
}
render(App)