Skip to main content

Module date_field

Module date_field 

Expand description

DateField: a day, shown as one fact and picked in a popover.

The field reads as a chip: the calendar icon and the day as the person reads a day (crate::format::day_fact_today: “Overdue since Jun 29”, “Today”, “Tomorrow”, “Thursday”, with the time of day it is due at when it has one — “Today 9:00 AM”), in the tone the fact stands in, or “Add date” in the quieter ink while it holds none, and the chevron every choice control wears. Pressing it opens a DatePicker in a popover anchored to the chip; picking a day sets the date and closes it. A field whose date may be empty adds “Clear date” under the calendar.

The time of day the day is due at is picked in the same popover, in the field’s time slot: the app keeps one beside the day (at: Option<Time> beside due), so the two are one fact and one control, never a second chip beside it. What the chip says comes from the at the owner shows it, through DateField::set_at: the field itself changes nothing but the day.

The owner learns of a change through DateField::on_change and tells the field a date from elsewhere with DateField::set_value, which changes the chip in place and never builds the popover again (what it holds — the calendar, the time row — stays what it was). The field never holds the authoritative value. A described component’s field follows the day its binding holds (DateField::from_state).

Structs§

DateField
See the module docs.
DateFieldProps
A day, shown as the person reads a day (with the time it is due at) and picked from a calendar that opens over it. A date that may be empty can be cleared, and the time it is due at is picked in the same popover, in the time slot.