TimeWindowPicker

Molecule

Relative presets ("1h", "7d"), an optional custom "last N minutes / hours / days", calendar periods ("today", "previous month", optionally "so far"), an absolute UTC range, and the interval / aggregation / time zone that go with a window. The value is a structural `TimeWindowValue` (ISO strings, UTC); every change dispatches a `kui:timewindow-change` DOM event (detail = the next value) and calls the global function named by `onChange`. Every label, period names included, is overridable through `messages`. Inline dashboard / telemetry sibling of DateRangePicker.

Default

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

Calendar periods, custom duration and time zone

Preview
{"mode":"calendar","period":"current.day","soFar":true}
Code
<%- include('modules/ui/TimeWindowPicker', {
  value: { mode: 'calendar', period: 'current.day', soFar: true },
  calendarPeriods: true, // all 18 periods; or a list such as ['current.day', 'previous.month']
  allowDuration: true, showTimezone: true,
}) %>

Presets only

Preview
{"mode":"relative","last":"24h"}
Code
<%- include('modules/ui/TimeWindowPicker', {
  value: { mode: 'relative', last: '24h' },
  presets: ['1h', '24h', '7d'],
  allowAbsolute: false, showInterval: false, showAggregation: false,
}) %>
Source modules/ui/TimeWindowPicker.ejs