'Choose date within a range using ipywidgets Date Picker

I need to create a widget that would allow the user to choose a date between two dates, say datetime.date(2021, 1, 1) and datetime.date(2023, 12, 31), and from the official documentation of ipywidgets I could not find anything more than this:

date_picker = widgets.DatePicker(
    description='Pick a Date',
    disabled=False,
)

Can someone please help me add constraints to the widgets? Thanks.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source