Single month picker
Good for monthly reports or billing cycles.
<script lang="ts">
let monthValue = $state<CwDateValue | undefined>();
</script>
<CwDateTimeRangePicker
mode="single"
granularity="month"
bind:value={monthValue}
/>Calendar picker — single/range, day/month/year granularity, optional time.
<CwDateTimeRangePicker
mode="range"
granularity="day"
includeTime
bind:value={value}
/>CwDateTimeRangePicker covers single dates, ranges, month and year picking, and optional time entry. The returned value shape changes with `mode`, so decide that up front.
| API | Type | Details |
|---|---|---|
mode Default: | 'single' | 'range' | Controls whether the component returns one date or a date range. |
granularity Default: | 'year' | 'month' | 'day' | Controls the picker depth. |
includeTime Default: | boolean | Adds time selection to the returned value. |
value | CwDateValue | undefined | Current selected date or range. |
maxDate Default: | Date | Latest selectable date. |
onchange | (value: CwDateValue) => void | Runs whenever a valid selection is emitted. |
name / required / placeholder / autocomplete | native attrs | Optional form integration attributes for the visible trigger input. |
These snippets intentionally show the full public API surface the live demo relies on.
Good for monthly reports or billing cycles.
<script lang="ts">
let monthValue = $state<CwDateValue | undefined>();
</script>
<CwDateTimeRangePicker
mode="single"
granularity="month"
bind:value={monthValue}
/>Use this for precise reporting windows or scheduled operations.
<script lang="ts">
let rangeValue = $state<CwDateValue | undefined>();
</script>
<CwDateTimeRangePicker
mode="range"
granularity="day"
includeTime
name="report-window"
required
placeholder="Select report window..."
maxDate={new Date()}
bind:value={rangeValue}
onchange={(value) => console.log(value)}
/>