TimeWindowSelect

Molecule

A time window behind one button, the dashboard way: the button names the window and opens a panel with Realtime (last N sliding, or the current calendar period, optionally so far) and History (last N anchored when applied, a fixed range typed in the window's zone, or a past period). Aggregation, grouping interval with a bucket estimate, and time zone apply to both. Edits are a draft until Update. Same `TimeWindowValue` as TimeWindowPicker: Update dispatches the same `kui:timewindow-change` DOM event and calls the global function named by `onChange`. The panel is a controlled Popover.

Default

Preview
{"mode":"relative","last":"24h","interval":"5m","aggregation":"avg"}
Code
<%- include('modules/ui/TimeWindowSelect', { value: { mode: 'relative', last: '24h' }, onChange: 'onWindowChange' }) %>
<script>
  document.addEventListener('kui:timewindow-change', (e) => console.log(e.detail));
</script>

History range in a chosen zone, no period options

Preview
{"mode":"absolute","from":"2026-10-16T05:00:00.000Z","to":"2026-10-16T17:00:00.000Z","timezone":"Europe/Istanbul","interval":"1h"}
Code
<%- include('modules/ui/TimeWindowSelect', {
  value: { mode: 'absolute', from, to, timezone: 'Europe/Istanbul' },
  calendarPeriods: [],
}) %>
Source modules/ui/TimeWindowSelect.ejs