Something went wrong

Thank you for being patient! We're working hard on resolving the issue

Timezone - Lona Docs Log in

Timezone Template

The timezone template renders a single timezone as a column legend, and shape-shifts into a calendar legend when nested under a timeline[column] ancestor (the calendar surface).

It's small but demonstrates the delegating renderer pattern: a child plugin that knows it might be claimed by an ancestor and paints accordingly.

Wire shape

{
  "type": "alias",
  "label": "Auckland",
  "attributes": {
    "template": "timezone",
    "props": { "tz": "Pacific/Auckland" }
  }
}
PropTypeRequiredMeaning
tzstringnoIANA timezone (omit for UTC)

Expanded shape

alias                             template=timezone
│                                 props.tz=Pacific/Auckland
└─ data-source                    label="Timezone"
   │                              attrs={dtype:"obj", tz:"Pacific/Auckland"}
   ├─ data-renderer               type=timezone              ← column slot
   └─ data-renderer               type=timeline-legend
                                  slot=timeline[column]      ← claimed by calendar

When the alias is standalone (no calendar ancestor), only the first renderer paints — the timeline[column] slot has no claimant:

alias                             template=timezone
└─ data-source
   ├─ data-renderer  type=timezone           ← paints "AKL" badge in column
   └─ data-renderer  type=timeline-legend    ← inert

When the alias sits inside a calendar (timeline[column] ancestor), the second renderer's slot is claimed by the calendar's legend walker; the column renderer drops out. The actual placement is four layers deep because secondary timezones land via preferences-secondary-timezones under the calendar's timeline-column wrapper:

alias                             template=calendar
└─ data-source                    preset=calendar
   └─ timeline-column              activeLayout="timeline[column]"
      └─ alias                    template=preferences-secondary-timezones
         └─ alias                 template=timezone               ← here
            └─ data-source
               ├─ data-renderer  type=timezone           ← inert
               └─ data-renderer  type=timeline-legend    ← claimed by calendar
                                                            paints in legend strip

The slot-claim mechanic works the same regardless of depth — what matters is having a timeline[column] ancestor somewhere up the chain, not the exact distance.

Both renderers are siblings on the same data-source. The router decides which one paints based on the ancestor's slot:

  • Standalone — no timeline[column] ancestor. The column renderer paints a tz badge in the row's column area; the timeline-legend slot is empty.
  • Inside a calendar — the calendar's timeline[column] slot claims the second renderer. The cell becomes a no-op; the calendar's own legend walker reads the tz attribute off the data-source and paints the badge in its legend strip.

This is how a single template ships one row that "does the right thing" in two layouts. No conditional shape, no parent inspection at template time — the slot system resolves it at render time.

With or without tz

When tz is absent, the data-source only carries { dtype: "obj" } — the renderer falls back to UTC.

See also