<qds-period-picker> selects calendar reporting months, quarters or years through native year and localized unit editors. It supports scalar or inclusive start/end values, native forms, validation and the standard QDS field lifecycle. It loads no date-picker, calendar, editor or framework runtime.
<script type="module" src="/assets/components/period-picker/qds-period-picker.js"></script>
<qds-period-picker label="Reporting month" name="period" value="2026-09" required></qds-period-picker>
<qds-period-picker granularity="quarter" label="Review quarters" name="quarters"
range value='["2026-Q1","2026-Q3"]'></qds-period-picker>
granularity is month (default), quarter or year. Values are canonical strings YYYY-MM, YYYY-Qn or YYYY, with years 0001–9999. Empty is ''; range mode uses a cloned [string, string].qds-date-picker date-only contracts are unchanged.required requires every active endpoint.min and max use the current granularity and are inclusive. Existing values remain visible for validation rather than being clamped. Malformed bounds are ignored. Reversed bounds can make every populated value invalid..value write is silent and current; the value attribute or .defaultValue defines reset state. Clean controls follow changed defaults. Dirty controls retain their current values until reset. Native form reset and string state restoration are supported.| Member | Contract |
|---|---|
value, defaultValue |
Canonical string or cloned string pair |
granularity, range |
Calendar unit and scalar/pair mode |
min, max |
Inclusive canonical bounds |
locale, formattedValue |
Localized month names/summary and read-only display string; canonical model unchanged |
startLabel, endLabel |
Range endpoint name suffixes; defaults Start/End |
label, aria-label, aria-labelledby |
Visible group name and explicit/external naming |
name, form |
Native scalar/repeated submission key and external form ID |
hint, errorText, invalid |
Instructions and application-owned errors |
required, readonly, disabled, size, validateOn |
Standard QDS field states/feedback timing |
validity, validationMessage, willValidate |
Field validity plus badInput, rangeUnderflow and rangeOverflow |
checkValidity(), reportValidity(), setCustomValidity(), focus() |
Validation/focus methods |
name twice in start/end order, including empty strings. Disabled controls are excluded; readonly values remain submitted. Direct new FormData() reads do not perform validation; ordinary validated submission rejects incomplete/crossed/out-of-bounds periods.input and change contain the native edit and emit one composed, bubbling CustomEvent with { component, value, granularity, range }. Pairs are cloned. Owner assignments, constraints, reset and restoration do not emit these user events.qds-validity-change reports typed valid/validity/message detail. Invalid owner strings normalize to empty; native incomplete edits retain their draft year/unit and report badInput. Year typing and focus survive ordinary feedback updates.locale controls month labels and visible summaries. Quarter labels retain Q1–Q4. Invalid locale values fall back to canonical numeric text. Programmatic/form values always retain their canonical spelling. Text is assigned through textContent, never interpreted as markup.The adjacent demo covers every granularity, paired ranges, native/external forms, reset/clear, bounds, locale, custom errors, readonly/disabled and typed events. Native and generated tests cover values, constraints, form state, keyboard behavior and light/dark themes. Run the repository verification gate for the complete acceptance checks.
Primary native contracts: HTML number input and HTML select.