# Time

## countdown

[See examples](https://legatobar.com/features#card-countdown)

Time until a moment, or since one.

| Field | | |
| --- | --- | --- |
| `label` | required | What happens then. |
| `at` | required | When, as ISO 8601 with seconds and a zone: `2027-03-12T19:15:00-04:00` or `2027-03-12T23:15:00Z`. Or Unix seconds, as services such as a weather API send a sunset, so a source can map it straight in: `{ "at": "current.sunset" }`. |
| `detail` | optional | Up to 120 characters: the gate, the price. |

Half width. The Mac counts down on its own between writes ("9d 4h", "2h 14m", "14m 32s"), shows "Now" at the moment and "2h 14m ago" after it, with the time or date under the count. Write the moment itself, not the time remaining, so the count stays right however long it is until the next write.

```json
{ "id": "boards", "type": "countdown", "label": "Flight boards", "at": "2027-03-12T19:15:00-04:00", "detail": "Gate B22" }
```

## window

[See examples](https://legatobar.com/features#card-window)

A window of time in the day, such as daylight, a store's hours or off-peak charging, drawn on one bar from midnight to midnight with now on it.

| Field | | |
| --- | --- | --- |
| `start` | required | When it starts: ISO 8601 with seconds and a zone, or Unix seconds as services send it. |
| `end` | required | When it ends, after the start and within a day of it. A window can cross midnight, such as 9 PM to 6 AM. |
| `next_start` | optional | When it next starts, so the time after it counts down to that. |
| `label` | optional | The headline in the window, up to 60 characters, like "Daylight left". Default "Left". |
| `before_label` | optional | The headline before it starts, like "Until sunrise" or "Opens in". Default "Starts in". |
| `after_label` | optional | The headline after it ends. With `next_start` it counts down to it (default "Starts in"); without, it counts up from the end (default "Ended"). |
| `start_label`, `end_label` | optional | Words before the start's and end's times under the bar, up to 24 characters each, like "Sunrise" and "Sunset". |
| `detail` | optional | A line under the bar, up to 120 characters. |

Full width. The track is a quiet grey, the window on it a pale chart colour, the part already gone the chart colour itself, and now a white knob, with the start and end times under their places. A window that crosses midnight shows at both ends of the bar. Above it, the time left counts down on its own. From a weather source, map sunrise and sunset straight in: OpenWeather's One Call answer has `daily[0].sunrise`, `daily[0].sunset` and `daily[1].sunrise`.

```json
{ "id": "daylight", "type": "window", "label": "Daylight left", "before_label": "Until sunrise", "after_label": "Until sunrise",
  "start": "2027-03-12T06:34:00-06:00", "end": "2027-03-12T18:17:00-06:00", "next_start": "2027-03-13T06:32:00-06:00",
  "start_label": "Sunrise", "end_label": "Sunset" }
```

## agenda

[See examples](https://legatobar.com/features#card-agenda)

Dated items over one day, a week or up to 30 days: meetings, an itinerary, an on-call rota, release windows, bills due.

| Field | | |
| --- | --- | --- |
| `label` | optional | |
| `days` | optional | 1–30, default 1: how many days the card shows, starting today in the Mac's time zone. Past a week, `hide_empty_days` keeps it short. |
| `hide_empty_days` | optional | `true` leaves out the days with nothing on them, instead of saying "Nothing scheduled" under each. When no day has anything, the card says it once. Default `false`. |
| `max_events` | optional | List no more than this many events, with **Show *N* more** under them for the rest. Today's events already over don't count and are left out until it's pressed, so the first events listed are still to come. |
| `hide_all_day_label` | optional | `true` leaves "All day" off all-day items, for a card where every item is a date, like bills due. When no item has a time, the time column goes too. Default `false`. |
| `items` | required | Up to 60 items, in any order. An empty list is allowed and shows "Nothing scheduled". |

Each item:

| Field | | |
| --- | --- | --- |
| `title` | required | 1–80 characters. |
| `start` | required | Either a date-time with seconds and a zone, like `countdown`'s `at` (`2027-03-12T09:30:00-06:00`), or a date, `2027-03-12`, for an all-day item. |
| `end` | optional | The same form as `start`, and not before it. A date `end` is the **last day**, inclusive: an offsite on the 12th and 13th is `"start": "2027-03-12", "end": "2027-03-13"` (not the 14th, as iCalendar would have it). |
| `detail` | optional | Up to 120 characters, on a line under the title: the room, the gate. |
| `url` | optional | An https link, or [another page](https://legatobar.com/docs/card-fields.md#links-to-other-pages). The button says **Join** from ten minutes before a timed item until it ends, and **Open** otherwise. |
| `state` | optional | `ok`, `warning`, `critical` or `unknown`, drawn as a coloured mark on the row. It doesn't count toward the page's status. |
| `color` | optional | `#RRGGBB`, such as a calendar's colour. It's drawn only as a thin bar at the row's leading edge, never as text or a fill, so any colour reads in light and dark mode. Anything else, like `blue` or `#123`, is an error. |
| `icon` | optional | An [item icon](https://legatobar.com/docs/card-fields.md#item-icons) before the title. |

Full width. The Mac groups items by day in its **current** time zone, under Today, Tomorrow and then the weekday, with all-day items first and timed ones by start time. An item that covers several days appears on each. Days in the window with nothing on them say "Nothing scheduled", so the card keeps its height (or are left out with `hide_empty_days`), and items outside the window are left out: write a week once and the card moves on a day at midnight by itself.

Today's past items are dimmed, a thin line marks now, and the item in progress shows "until 10:45". All of that keeps up on the Mac's own clock, with no write needed. An all-day item is a date, not a moment, so it stays on its day wherever the Mac is; a timed item written in another zone also shows its own time ("9:00 AM GMT+9"), so an itinerary written in one zone still reads right in another.

```json
{ "id": "schedule", "type": "agenda", "label": "Schedule", "days": 2, "items": [
  { "title": "Release freeze", "start": "2027-03-12", "end": "2027-03-14", "color": "#E8710A" },
  { "title": "Design review", "start": "2027-03-12T09:50:00-06:00", "end": "2027-03-12T10:45:00-06:00",
    "detail": "Room 4", "url": "https://meet.example.com/design" },
  { "title": "Flight UA 512", "start": "2027-03-13T07:05:00-06:00", "detail": "ORD → SFO, gate B12", "state": "warning" } ] }
```

## month

[See examples](https://legatobar.com/features#card-month)

This month as a grid, with the chosen day's items under it.

| Field | | |
| --- | --- | --- |
| `label` | optional | |
| `items` | required | Up to 300 items in the [agenda](https://legatobar.com/docs/card-time.md#agenda)'s form, in any order. An empty list is allowed. |
| `days` | optional | 1–30, default 1: how many days the list under the grid shows, from the chosen day, as an [agenda](https://legatobar.com/docs/card-time.md#agenda)'s `days` does. With `30`, the next month at a glance under the grid. |
| `hide_empty_days` | optional | With `days`, `true` leaves out the days with nothing on them, instead of saying "Nothing scheduled" under each. When no day has anything, the card says it once. Default `false`. |
| `max_events` | optional | List no more than this many events under the grid, with **Show *N* more** for the rest, as an [agenda](https://legatobar.com/docs/card-time.md#agenda)'s `max_events` does. The grid's dots still show every item. With `"days": 30, "max_events": 20`, the next 20 events and the rest a click away. |

Full width. The grid shows six weeks from the week of the 1st, in the Mac's current time zone and starting on its first day of the week, so the card keeps its height and the last days reach into next month. Today is filled with the accent colour. A day with items gets up to three dots, one per `color` (grey for items without one).

Today is chosen until someone clicks another day, and the chosen day's items are listed under the grid as the agenda lists them: all-day items first, a line at now, **Join** and **Open**. With `days`, the list runs on from the chosen day for that many days, each under its own heading. The same items fill either card, so a page can switch between `agenda` and `month` by changing `type`. Each day of the month moves on at midnight by itself; on the 1st the grid turns to the new month.

The arrows beside the month's name page up to 12 months either way, and **Today** comes back; the panel opens on this month each time. A card shows the items written for whichever month it's on, so include the months you want someone to be able to page to, within the 300 items. A [calendar source](https://legatobar.com/docs/source-calendar.md#calendar-sources) reads each month as it's shown, and 30 days past it for the list.

```json
{ "id": "month", "type": "month", "items": [
  { "title": "Release freeze", "start": "2027-03-12", "end": "2027-03-14", "color": "#E8710A" },
  { "title": "Design review", "start": "2027-03-12T09:50:00-06:00", "end": "2027-03-12T10:45:00-06:00",
    "detail": "Room 4", "url": "https://meet.example.com/design", "color": "#1A73E8" },
  { "title": "Offsite", "start": "2027-03-17", "end": "2027-03-18", "detail": "Lake house", "color": "#E8710A" } ] }
```

## timeline

[See examples](https://legatobar.com/features#card-timeline)

A dated history, newest first: a package's tracking events, a job's runs, an order's steps. It's drawn as an [agenda](https://legatobar.com/docs/card-time.md#agenda) is, under day headings with a time column, and a rail of nodes beside the times. The newest event is the current one, with a filled node.

| Field | | |
| --- | --- | --- |
| `label` | optional | Left out, the card has no title row, as a [checklist](https://legatobar.com/docs/card-lists.md#checklist)'s. |
| `items` | required | Up to 60 events (below). When Legato can read every one's `at`, it sorts them newest first itself; otherwise they stay in the order sent, which should be newest first. An empty list is allowed and says "No events yet". |
| `next` | optional | What the source expects next, such as a delivery window: `{ "title", "start", "end", "detail" }`, with `start` and `end` in the forms `at` takes. It's drawn above the newest event, a hollow node on a dashed rail, never as an event. Without a `start` Legato can read there's no row, so a source can map an expected date that's sometimes missing. A date alone leaves the time column empty, and `end` on the same day reads "2 – 6 PM". Once the window is over it's dimmed; Legato doesn't call it late. |
| `max_items` | optional | Show the newest so many events, with **Show *N* more** for the rest. The newest always shows; `next` and quiet spells don't count. |
| `gap_days` | optional | 1–30. When two shown events are this many days apart or more, a grey "No updates for 3 days" sits between them on a dashed stretch of rail, and above the newest when it's that old. It keeps up with the Mac's clock. A package page uses 2. |

Each item:

| Field | | |
| --- | --- | --- |
| `title` | required | 1–80 characters, the event in the source's own words: Out for delivery, Arrived at facility. |
| `at` | required | When it happened: ISO 8601, a date (`2026-11-04`, drawn with no time), a date and time with no zone (`2026-11-04 14:30:00`, read as the Mac's time), Unix seconds, or a carrier's own words, such as `Monday, November 2, 2026 3:14 PM`, `November 2, 2026 03:14 PM EST` or `02.11.2026 14:30`. Words with no zone are read on the Mac's clock, so the time shows as the carrier wrote it. A time Legato can't read is shown as written on the detail line, under the day before it. |
| `detail` | optional | Up to 120 characters on the line under the title: where it happened. |
| `state` | optional | `warning`, `critical` or `unknown` draws that mark on the rail in place of the node, for an exception or a failed delivery attempt; `ok` and `off` are the plain node. Like an agenda item's, it doesn't count toward the page's status: a `status` card says how the whole thing stands. |
| `icon` | optional | An [item icon](https://legatobar.com/docs/card-fields.md#item-icons) before the title. |

Full width. Days are headed Today, Yesterday, then "Wednesday, Nov 4" (with the year when it isn't this one), in the Mac's current time zone. Each title and detail is one line, cut short with the whole text as its tooltip, so no row grows. There's no progress ring, percentage or row for a step that hasn't happened: a history says what happened, and only `next` looks ahead. VoiceOver reads each row whole ("Out for delivery, Beaverton, OR, today at 8:12 AM, latest"; "Weather delay, Hodgkins, IL, yesterday at 6:02 AM, needs attention"), and the days as headings.

```json
{ "id": "tracking", "type": "timeline", "label": "Tracking", "max_items": 6, "gap_days": 2,
  "next": { "title": "Expected delivery", "start": "2027-03-12T14:00:00-06:00", "end": "2027-03-12T18:00:00-06:00" },
  "items": [
    { "title": "Out for delivery", "at": "2027-03-12T08:12:00-06:00", "detail": "Beaverton, OR" },
    { "title": "Weather delay", "at": "2027-03-11T06:02:00-06:00", "detail": "Hodgkins, IL", "state": "warning" },
    { "title": "Departed from facility", "at": "2027-03-07T16:20:00-08:00", "detail": "Ontario, CA" } ] }
```

Filled from [Parcel](https://parcelapp.net/help/api-view-deliveries.html) on a [page for every package](https://legatobar.com/docs/detail-pages.md#one-page-for-every-item): the delivery whose tracking number the link names, its events, the newest marked when Parcel reports a failed attempt (6) or an exception (7), and its expected window as `next`. Parcel passes each carrier's own times through, in whatever words the carrier uses, and the card reads them:

```json
"derive": [ { "name": "this", "value": { "each": "recent.deliveries", "where": { "path": "tracking_number", "equals": "{param.tracking}" },
  "fields": { "events": "events", "code": "status_code", "expected": "date_expected", "expected_end": "date_expected_end" } } } ]

"source": { "ref": "parcel", "map": {
  "items": { "each": "this[0].events", "limit": 60, "fields": { "title": "event", "at": "date", "detail": "location" } },
  "items[0].state": { "path": "this[0].code", "values": { "6": "warning", "7": "warning" } },
  "next.title": { "template": "Expected delivery" },
  "next.start": "this[0].expected",
  "next.end": "this[0].expected_end" } }
```

## strip

[See examples](https://legatobar.com/features#card-strip)

An item's states over a span, one thin bar per slice, coloured by the state it was in: a monitor's last day, a host's week, a container's month. It's drawn from [samples History keeps](https://legatobar.com/docs/history-collect.md#samples), and it says what happened, not how things stand now.

| Field | | |
| --- | --- | --- |
| `label` | optional | The card's title, like "Last 24 hours". |
| `segments` | required | Up to 240 slices, oldest first, each `{ "state", "label" }`. An empty list draws an empty track. |
| `start_label`, `end_label` | optional | Up to 40 characters under each end: "24 hours ago" and "Now". |
| `detail` | optional | Up to 40 characters beside the title: what the span adds up to, like "99.2% up". |

Each segment's `state` is `ok`, `warning`, `critical`, `unknown` or `off`, as a [status](https://legatobar.com/docs/card-lists.md#status) card has them, or `none` for a slice with no data, drawn as the empty track. Words that aren't a state are `unknown`; a segment without one is `none`. `label`, up to 80 characters, is what the segment says when the pointer is over it: "3 PM · down 12 min".

Full width, 18 points high. With room, bars have a 1-point gap; past about 100 segments on a panel they touch. The segment under the pointer is marked, and its label and state take the place of the two end labels on the same line, so the card doesn't grow or move; they come back when the pointer leaves. VoiceOver reads the title and how many slices were in each state ("Last 24 hours; 2 critical, 94 OK; 99.2% up"), and steps through the segments one by one with increment and decrement.

A strip is history, not status: it never counts toward the page's status, a section's dot or a notification, whatever its segments say. Put a `status` card beside it for how the item stands now.

```json
{ "id": "history", "type": "strip", "label": "Last 24 hours", "detail": "99.2% up",
  "start_label": "24 hours ago", "end_label": "Now",
  "segments": [ { "state": "ok", "label": "2 PM" }, { "state": "critical", "label": "3 PM · down 12 min" },
                { "state": "none", "label": "4 PM" } ] }
```

Filled from an item's samples on a [page for every item](https://legatobar.com/docs/detail-pages.md#one-page-for-every-item), with [`by_time`](https://legatobar.com/docs/mapping-expiry.md#slices-of-time) cutting the span into equal slices and [`worst`](https://legatobar.com/docs/mapping-expiry.md#slices-of-time) giving each one the worst state in it. Without `buckets`, `by_time` makes 144 slices, ten minutes each of a day:

```json
"sources": { "samples": { "dataset": "kuma-samples", "key": "{param.id}",
  "derive": [ { "name": "up", "value": { "multiply": [ { "divide": [
      { "count": "kept.rows", "where": { "path": "row.state", "equals": "ok" } }, { "count": "kept.rows" } ] }, 100 ], "round": 1 } } ] } }

"source": { "ref": "samples", "map": {
  "segments": { "each": "kept.rows", "by_time": { "at": "at", "span": "kept.span" },
                "fields": { "state": { "worst": "row.state", "of": "rows" }, "label": { "template": "{from|time}" } } },
  "detail": { "template": "{up}% up" } } }
```

## heatmap

[See examples](https://legatobar.com/features#card-heatmap)

A square per day, in week columns, each shaded by how much happened that day: a year of GitHub contributions, of steps, of tasks done. Weeks run left to right, oldest first, and days top to bottom, Sunday at the top, as GitHub draws its calendar. It says what happened, not how things stand now.

| Field | | |
| --- | --- | --- |
| `label` | optional | The card's title, like "Contributions". |
| `detail` | optional | Up to 40 characters beside the title: what the span adds up to, like "1,194 in the past year". The page works it out; the card doesn't. |
| `items` | required | Up to 371 days, each `{ "date", "value", "level", "label", "url" }`. An empty list says "No data". |
| `thresholds` | optional | 4 ascending numbers where levels 1 to 4 start, for an absolute scale. |

- **`date`** is a day, `YYYY-MM-DD`, placed as written: Legato never turns it into a moment, so no time zone can move it. A date with a time after it (`2026-11-08T00:00:00Z`) counts as its date part. The first date to the last span at most 371 days, and the grid runs from the first to the last: to end at today, include today's item. If two items have the same date, the last one wins, so group rows by date first.
- **`value`** is how much happened, and **`level`** is the shade, a whole number from 0 to 4. A given `level` wins. Without one, `thresholds` place the value: `[1, 2500, 5000, 10000]` makes 0 steps level 0, 3,000 level 2 and 12,000 level 4. Without thresholds, 0 and below are level 0 and the rest fall in the quartiles of every value above 0, as GitHub's own calendar does; with only a few values, the top levels may go unused.
- **A missing day is not a zero.** A date between the first and the last with no item, or an item with neither `value` nor `level`, is drawn as an empty outline: no data. A measured 0 is a grey square. A page whose service leaves out days that really were zero gives those days `"value": 0`.
- **`label`**, up to 80 characters, is what the day says under the pointer: "3 contributions on Nov 9". Without one, the date and value ("Nov 9, 2025 · 3").
- **`url`**, https or another page, is what a click on the day opens.

Full width. The squares fill the card's width, about 53 columns of 6 points in the panel, up to 14 points for a span of a few weeks; that's 7 rows, about 46 points high for a year. The month names sit over the first column of each month, and Less … More under the grid shows the five shades: grey for 0, then the theme's chart colour stronger for each level. The day under the pointer is outlined and its label takes the legend's place on the same line, so the card doesn't grow or move; the legend comes back when the pointer leaves. VoiceOver reads the title and the detail (or how many days have data, and their total), and steps through the days one by one with increment and decrement, saying "No data" for a missing one; a day with a link can be opened from there.

A heatmap is history, not status: it never counts toward the page's status, a section's dot or a notification.

```json
{ "id": "steps", "type": "heatmap", "label": "Steps", "detail": "8,412 a day",
  "thresholds": [1, 2500, 5000, 10000],
  "items": [ { "date": "2026-11-01", "value": 0 }, { "date": "2026-11-02", "value": 3100 },
             { "date": "2026-11-04", "value": 12500, "label": "12,500 steps on Nov 4" } ] }
```

GitHub's contribution calendar is a list of weeks, each with its days: [`flatten`](https://legatobar.com/docs/mapping-tables.md#turning-a-table-round) turns it into one list of days. Map `contributionLevel` to `level`, not its `color`, so the card draws in Legato's shades in light and dark. `last` keeps a longer answer to the newest 371 days:

```json
"source": { "ref": "calendar", "map": {
  "items": { "each": "data.viewer.contributionsCollection.contributionCalendar.weeks", "flatten": "contributionDays", "last": 371,
    "fields": { "date": "date", "value": "contributionCount",
      "level": { "path": "contributionLevel", "values": { "NONE": 0, "FIRST_QUARTILE": 1, "SECOND_QUARTILE": 2, "THIRD_QUARTILE": 3, "FOURTH_QUARTILE": 4 } } } },
  "detail": { "template": "{data.viewer.contributionsCollection.contributionCalendar.totalContributions} in the past year" } } }
```

A [History](https://legatobar.com/docs/history.md) dataset dated by day gives a day per group: `{ "each": "kept.rows", "group": "date", "fields": { "date": "key", "value": { "count": "rows" } } }`.

