v3.0.0 Are you ready for an upgrade? Introducing version 3.0.0 of our date picker! 🎉
This release brings a game-changing feature: the date picker is now a controlled component. This is a widely used pattern for interacting with date pickers, allowing for more control and flexibility in your applications.
With this update, every time a date is selected, it will be passed to the onDatesChange function. However, please note that this update also brings some breaking changes.
🚫 Breaking changes
- 👮 The date picker is now controlled, so you'll need to pass the
selectedDates
andonDatesChange
to the configuration. - 🙅♂️ Additionally, the
setDay
andsetRangeEnd
actions have been removed, so you can now manipulateselectedDates
outside of the date picker.
Migrating from version 2 to version 3 is simple:
- Remove
selectedDates
from the "dates" configuration - Make date picker controlled
const [selectedDates, onDatesChange] = useState<Date[]>([]);
const { data } = useDatePicker({
selectedDates,
onDatesChange,
})
- Remove all logic with
setDay
andsetRangeEnd
actions.
But don't worry, after these changes, you'll be good to go and enjoy the power of a controlled date picker!🎉