SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

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.

tsx
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

typescript
viewerTime(arg0: ViewerTimeArgs): MixinDescriptor<HTMLTimeElement>

Parameters

ParameterTypeRequiredDescription
arg0ViewerTimeArgsYes

Examples

tsx
<time dateTime={iso} mix={[viewerTime(locale, now)]}>{serverText}</time>
@sdxc/ui

Can’t find it? Contact us