Documents v0.10.0 · previews run the real runtime · experimental features are marked exp

timezone()

functionsince 0.10experimentalrequires runtime

The same instant, shown by format() in an IANA time zone.

On this page · 8 sections+

Syntax

timezone(<datetime>, "<Area/City>")

registry syntax: timezone(datetime, "Area/City")

Parameters

datetimedatetimerequired
From time() or a datetime state.
zonequoted IANA namerequired
A literal is checked when the stylesheet is compiled; a zone from a state when it is evaluated.

Return value

A datetime.

Example

tokyo.cssreactive
.clock { --now: state(time()); }.clock:on(every(1s)) { --now: set(time()); }.clock .tokyo { text: format(timezone(--now, "Asia/Tokyo"), "HH:mm:ss"); }
state()Function · hover any red tokenMakes each matching element the owner of an independent state with an initial value.Reference →

Behavior

  • Daylight saving comes from the browser's zone data. Without timezone(), format() uses the browser's zone.

Supported contexts

  • :on() actions: set(lower(event(value))).
  • :when() and when() conditions: :when(includes(--a, --b)).
  • Declarations, including text:: text: length(trim(--value)).

Limitations

    Experimental · syntax may change between minor versions