CwDateTimeRangePicker

Calendar picker — single/range, day/month/year granularity, optional time.

Single Day

Date Range

Month Granularity

With Time

CwDateTimeRangePicker example Copy code
<CwDateTimeRangePicker
	mode="range"
	granularity="day"
	includeTime
	bind:value={value}
/>
Documentation Upgrade

Start here

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.

How to think about it

  1. Choose single or range mode first Single mode returns `{ date }`, while range mode returns `{ start, end }`. That choice drives the value shape for the rest of the form.
  2. Pick the granularity that matches the report Use `day` for exact dates, `month` for monthly rollups, and `year` for broad reporting periods.
  3. Enable time only when the workflow needs it Including time adds more controls and more value fields, so keep it off for date-only filters.

Props and callbacks

APITypeDetails
mode

Default: single

'single' | 'range'Controls whether the component returns one date or a date range.
granularity

Default: day

'year' | 'month' | 'day'Controls the picker depth.
includeTime

Default: false

booleanAdds time selection to the returned value.
value
CwDateValue | undefinedCurrent selected date or range.
maxDate

Default: new Date()

DateLatest selectable date.
onchange
(value: CwDateValue) => voidRuns whenever a valid selection is emitted.
name / required / placeholder / autocomplete
native attrsOptional form integration attributes for the visible trigger input.

Copy-paste examples

These snippets intentionally show the full public API surface the live demo relies on.

Single month picker

Good for monthly reports or billing cycles.

Single month picker Copy code
<script lang="ts">
	let monthValue = $state<CwDateValue | undefined>();
</script>

<CwDateTimeRangePicker
	mode="single"
	granularity="month"
	bind:value={monthValue}
/>
Range picker with time

Use this for precise reporting windows or scheduled operations.

Range picker with time Copy code
<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)}
/>