pota/use/time

Clock formatters, useTimeout for auto-disposing timers, useElapsed for relative-time readers that re-render on unit boundaries, and useStopwatch for start/stop/reset counters.

Exports

time

time(timestamp = now()) formats a timestamp as HH:MM. The other clock formatters are date, datetime, timeWithSeconds, and day; all default to now().

Examples

Format the current time

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)