Date range picker
ui.DateRangePicker holds a start and an end date. Its popup shows two months: the first click picks the start, the pointer previews the range and the second click picks the end (in any order). The column on the left has quick ranges (today, last 7 days, this week, this month, last month…). on_change receives (start, end) as two datetime.date.
ui.DateRangePicker · Category: Dates and times · Full reference →


pz.container( ui.DateRangePicker(value=("2026-10-05", "2026-10-14"), format="DD/MM/YYYY", on_change=on_change), width=260, height=330, align_y="start")When to use
Section titled “When to use”- For reports, filters, stays and anything that spans days.
months=1shows a single month andpresets=Falsehides the quick ranges.- The field can be typed too: two dates in
formatwith any separator.
import pyzed as pzfrom pyzed import ui
class Report(pz.App): def __init__(self): self.period = (None, None)
def view(self): start, end = self.period days = (end - start).days + 1 if start and end else 0 return pz.column([ ui.DateRangePicker(value=self.period, format="MMM D, YYYY", on_change=lambda e: setattr(self, "period", e.value)), ui.label(f"{days} days selected", color="text_muted"), ], spacing=8, width=300)Variants
Section titled “Variants”

months=2Code
ui.DateRangePicker(value=("2026-10-05", "2026-10-14"), on_change=on_change)

months=1, presets=FalseCode
ui.DateRangePicker(months=1, presets=False, on_change=on_change)Events
Section titled “Events”Date range picker has 3 events of its own, listed below. Like every widget it also has the 18 common events (click, double_click, right_click, mouse_enter, drag, key_down, resize…), attached with .on(...): see Events and Events of every component.
It is a pz.Component, so it also raises on_mount and on_unmount, and its handlers get a pz.Event whose value holds the data.
| Event | Handler gets | When |
|---|---|---|
on_change |
(event) |
Receives event.value: (start, end). |
on_open |
(event) |
The calendar opened. |
on_close |
(event) |
The calendar closed. |
Handler gets is what Pyzed passes to your callable: () means nothing. Any handler can also be a message (a value that is not callable), which goes to update().
Handling the events
Section titled “Handling the events”The same events written three ways. Imperative: methods of the app change self. Declarative: the handlers produce messages and one update() decides. Functional: a pure function draws an immutable state and asks for changes with set_state(...). See Imperative, declarative and functional.
class Report(pz.App): def __init__(self): self.period = ("2026-10-05", "2026-10-14")
def changed(self, event): # on_change: event.value is (start, end) self.period = event.value
def view(self): start, end = self.period return pz.column([ ui.DateRangePicker(value=self.period, on_change=self.changed), ui.label(f"From {ui.format_date(start, 'D MMM')} to {ui.format_date(end, 'D MMM')}"), ], spacing=8, width=280)from dataclasses import dataclass
@dataclassclass Period: days: tuple
class Report(pz.App): period = (None, None)
def update(self, message): match message: case Period(days): self.period = days
def view(self): return ui.DateRangePicker(value=self.period, on_change=lambda e: Period(e.value))from dataclasses import dataclass
@dataclass(frozen=True)class State: period: tuple = (None, None)
def view(state, set_state): return ui.DateRangePicker(value=state.period, months=1, presets=False, on_change=lambda e: set_state(period=e.value))Properties and API
Section titled “Properties and API”ui.DateRangePicker
Section titled “ui.DateRangePicker”class DateRangePickerA component: a field for a start and an end date, with two months and quick ranges (Today, Last 7 days, This month…) in its popup. Typed text is two dates separated by separator. See the Date range picker page.
| Property | Default | Description |
|---|---|---|
value |
None |
(start, end): dates, ISO text or None. |
format |
"YYYY-MM-DD" |
How each date is written. |
separator |
" – " |
Text between the two dates. |
placeholder |
"" |
Hint while empty. |
min |
None |
The earliest date. |
max |
None |
The latest date. |
disabled_dates |
() |
Days that cannot be picked. |
first_weekday |
"monday" |
"monday", "sunday" or "saturday". |
months |
2 |
Months shown side by side. |
presets |
True |
Shows the quick ranges. |
clearable |
True |
Shows an x that empties it. |
disabled |
False |
Greys it out. |
invalid |
False |
Paints the border in the error color. |
Events: on_change, on_open, on_close (events).