Highlights
This release includes important bug fixes, TypeScript improvements, and a new feature. Most notably, it restores date parsing behavior that was accidentally removed in v8.0.0.
New Feature
Allow onClickOutside to prevent calendar from closing (#6179)
The onClickOutside callback can now prevent the calendar from closing by calling event.preventDefault(). This is useful when using custom portal-based dropdowns in the calendar header.
<DatePicker
onClickOutside={(event) => {
if (myPortalRef.current?.contains(event.target)) {
event.preventDefault(); // Keeps calendar open
}
}}
/>
Full Changelog
What's Changed
- docs: Fix outdated setup instructions in CONTRIBUTING.md by @te-ing in #6133
- fix: prevent webpack warning for optional date-fns-tz dependency by @martijnrusschen in #6155
- test: add tests for openToDate with showTimeSelectOnly by @martijnrusschen in #6157
- fix: TypeScript type improvements for DatePicker props by @martijnrusschen in #6156
- fix: remove empty :global selector that breaks Lightning CSS by @martijnrusschen in #6165
- fix: restore v8 default styles by @stropitek in #6144
- fix: remove extra wrapper div when using withPortal by @martijnrusschen in #6167
- fix: prevent Safari auto-translate from breaking calendar by @martijnrusschen in #6168
- fix: prevent crash when date props are passed as strings by @martijnrusschen in #6166
- fix: add base styles for month/year select dropdowns by @martijnrusschen in #6169
- small tweak by @martijnrusschen in #6170
- test: add tests for year boundary handling in month picker range selection by @martijnrusschen in #6171
- test: add formatWeekDay prop test for DatePicker component by @martijnrusschen in #6177
- feat: allow onClickOutside to prevent calendar from closing by @martijnrusschen in #6179
- fix: clear selection when masked input is cleared on blur by @martijnrusschen in #6180
- fix: restore native Date fallback when strictParsing is false by @martijnrusschen in #6172
New Contributors
- @te-ing made their first contribution in #6133
- @stropitek made their first contribution in #6144
Full Changelog: v9.0.0...v9.1.0