Upgrading
Upgrade to v8
DayPicker v8 is a major upgrade for DayPicker with new props and styles. Follow the checklist for a smooth upgrade.
Checklist
- Upgrade the dependency. DayPicker now has date-fns as peer dependency.
- npm
- Yarn
- pnpm
- Bun
npm install react-day-picker@latest date-fnsyarn add react-day-picker@latest date-fnspnpm add react-day-picker@latest date-fnsbun add react-day-picker@latest date-fns - Remove the types package, if you were using it:
- npm
- Yarn
- pnpm
- Bun
npm uninstall @types/react-day-pickeryarn remove @types/react-day-pickerpnpm remove @types/react-day-pickerbun remove @types/react-day-picker - Update the CSS import:
- import `react-day-picker/lib/style.css`
+ import `react-day-picker/dist/style.css` - Update your custom styles. See the Styling Guide for more information.
- Update the changed props. See the list below.
- Replace
DateUtilswith date-fns. Use date-fns instead of DateUtils to handle dates.- Replace
addDayToRangewith addToRange, which is still exported in v8
- Replace
Updated Props
showWeekNumbershas been renamed toshowWeekNumbertodayButtonhas been removed. See Controlling the current month for an example implementing the same feature.initialMonthhas been renamed todefaultMonth. See Navigating months for more details about usingmonthanddefaultMonth.canChangeMonthhas been renamed todisableNavigationselectedDayshas been renamed toselected. See also: Selecting Days guide.disabledDayshas been renamed todisabled. See also: Disabling days.
ISO weeks
This version use the locale setting to calculate the week days and numbers. The previous versions were using ISO week dates. To toggle the ISO week dates, use the ISOWeek prop.
DayPickerInput
The DayPickerInput component has been removed. If you upgrade to v8, you will need to rewrite your implementation:
- See Input Fields Guide for an example
- Please note that
useInput hookhas been deprecated since v8.10.0.