viewerTime
Why JS: a server cannot know the viewer's time zone or clock, so a relative time it renders names the server's zone.
import { viewerTime } from "@sdxc/ui/mixins";Usage
Rewrites the host <time> from its own datetime once it is live in a document, and after
every update around it: the date and title in the viewer's zone, the text against now when
given and the viewer's clock otherwise, so a fixed reference reads the same on every machine.
Signature
viewerTime(arg0: ViewerTimeArgs): MixinDescriptor<HTMLTimeElement>Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
arg0 | ViewerTimeArgs | Yes |
Examples
<time dateTime={iso} mix={[viewerTime(locale, now)]}>{serverText}</time>