Skip to main content

date_picker_range

Function date_picker_range 

Source
pub fn date_picker_range(
    title: &str,
    state: &BoundState<f64>,
    lower: f64,
    upper: f64,
) -> View
Expand description

DatePicker(_:selection:in:displayedComponents:) — a date picker with bounds.

“Pick a date after today” is a constraint a date picker exists to express, and only the unbounded initialiser was bound — so every picker offered every date and the check had to happen afterwards.

The bounds are seconds from Apple’s reference date, the same scale date_picker_bound takes.

let when = BoundState::new(500_000.0);
let picker = date_picker_range("When", &when, 0.0, 1_000_000.0);