yr.date_picker

date_picker(
    label: str,
    default_date: date | str | None = None,
) → date

Present the user with a date picker.

Parameters

label
type: str

Prompt shown alongside the picker.

default_date
type: date | str | None = None

Optional initial date, as a date or ISO-format string.

Returns

type: date

The date the user chose.

Examples

Ask the user to choose a departure date, starting with a suggested value:

python
import yera as yr

departure = yr.date_picker(
    "When would you like to leave?",
    default_date="2027-06-15",
)
yr.markdown(f"Your departure date is **{departure}**.")