-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade date-fns to v3 #4481
Upgrade date-fns to v3 #4481
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ This pull request was sent to the PullRequest network.
@ethanve you can click here to see the review status or cancel the code review job.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PullRequest Breakdown
Reviewable lines of change
+ 97
- 92
76% JavaScript
23% JavaScript (tests)
1% JSON
Generated lines of change
+ 5
- 7
Type of change
Feature - These changes are adding a new feature or improvement to existing code.
@@ -249,15 +249,15 @@ describe("date_utils", () => { | |||
).toBe(true); | |||
}); | |||
|
|||
it("should throw error if excluded date interval is invalid", () => { | |||
it("should be enabled and normalize negative intervals correctly", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functions that accept Interval arguments now do not throw an error if the start is before the end and handle it as a negative interval. If one of the properties in an Invalid Date, these functions also do not throw and handle them as invalid intervals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While these are minor, I would recommend considering combining your imports now that you can match the style of your other imports. Beyond that I found no issues to prevent this from moving forward
Reviewed with ❤️ by PullRequest
import * as DateFNS from "date-fns/esm"; | ||
import fi from "date-fns/locale/fi"; | ||
import ptBR from "date-fns/locale/pt-BR"; | ||
import enGB from "date-fns/locale/en-GB"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the new changes, I believe you can also combine this:
import { fi, ptBR, enGB } from "date-fns/locale";
🔹 Simplify Code (Nice to have)
import toDate from "date-fns/toDate"; | ||
import parse from "date-fns/parse"; | ||
import parseISO from "date-fns/parseISO"; | ||
import longFormatters from "date-fns/esm/_lib/format/longFormatters"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe these can be combined now too, which would make future updates like this smaller and easier:
import {
isDate,
isValid as isValidDate,
// etc
} from "date-fns";
[](#40d7fa71-0d7a-4e8b-bceb-bc2d8373eb84 "PullRequest Meta [Do Not Modify]")
###### 🔹 Simplify Code (Nice to have)
![Image of James D](https://static.pullrequest.com/avatars/reviewer_profiles/d88c81ac-6b7b-4d51-97f8-612312f23ba2?v=1b04Ew) **James D**
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty straightforward update. No merge blocking issues found. Thanks for the PR!
Reviewed with ❤️ by PullRequest
This looks good, are there any breaking changes that require a major version bump of the package? |
@martijnrusschen I believe this should be a major version bump given the breaking changes in date-fns. This will not work with date-fns v2. |
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [react-datepicker](https://github.com/Hacker0x01/react-datepicker) | [`^5.0.0` -> `^6.0.0`](https://renovatebot.com/diffs/npm/react-datepicker/5.1.0/6.0.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/react-datepicker/6.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/react-datepicker/6.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/react-datepicker/5.1.0/6.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-datepicker/5.1.0/6.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>Hacker0x01/react-datepicker (react-datepicker)</summary> ### [`v6.0.0`](https://github.com/Hacker0x01/react-datepicker/releases/tag/v6.0.0): 6.0.0 [Compare Source](https://github.com/Hacker0x01/react-datepicker/compare/v5.1.0...v6.0.0) #### What's Changed - Upgrade date-fns to v3 by [@​ethanve](https://github.com/ethanve) in [https://github.com/Hacker0x01/react-datepicker/pull/4481](https://github.com/Hacker0x01/react-datepicker/pull/4481) - Switch workflows to Node 20 by [@​martijnrusschen](https://github.com/martijnrusschen) in [https://github.com/Hacker0x01/react-datepicker/pull/4490](https://github.com/Hacker0x01/react-datepicker/pull/4490) #### New Contributors - [@​ethanve](https://github.com/ethanve) made their first contribution in [https://github.com/Hacker0x01/react-datepicker/pull/4481](https://github.com/Hacker0x01/react-datepicker/pull/4481) **Full Changelog**: Hacker0x01/react-datepicker@v5.1.0...v6.0.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xNTMuMiIsInVwZGF0ZWRJblZlciI6IjM3LjE1My4yIiwidGFyZ2V0QnJhbmNoIjoiY2FuYXJ5In0=-->
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [react-datepicker](https://github.com/Hacker0x01/react-datepicker) | [`^4.14.0` -> `^6.0.0`](https://renovatebot.com/diffs/npm/react-datepicker/4.25.0/6.1.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/react-datepicker/6.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/react-datepicker/6.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/react-datepicker/4.25.0/6.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-datepicker/4.25.0/6.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [@types/react-datepicker](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-datepicker) ([source](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react-datepicker)) | [`^4.11.2` -> `^6.0.0`](https://renovatebot.com/diffs/npm/@types%2freact-datepicker/4.19.6/6.0.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@types%2freact-datepicker/6.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@types%2freact-datepicker/6.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@types%2freact-datepicker/4.19.6/6.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@types%2freact-datepicker/4.19.6/6.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>Hacker0x01/react-datepicker (react-datepicker)</summary> ### [`v6.1.0`](https://github.com/Hacker0x01/react-datepicker/releases/tag/v6.1.0): 6.1.0 [Compare Source](https://github.com/Hacker0x01/react-datepicker/compare/v6.0.0...v6.1.0) #### What's Changed - Fix - Removed defaultProps from Function Components for React 18.3. by [@​shyk001](https://github.com/shyk001) in [https://github.com/Hacker0x01/react-datepicker/pull/4498](https://github.com/Hacker0x01/react-datepicker/pull/4498) #### New Contributors - [@​shyk001](https://github.com/shyk001) made their first contribution in [https://github.com/Hacker0x01/react-datepicker/pull/4498](https://github.com/Hacker0x01/react-datepicker/pull/4498) **Full Changelog**: Hacker0x01/react-datepicker@v6.0.0...v6.1.0 ### [`v6.0.0`](https://github.com/Hacker0x01/react-datepicker/releases/tag/v6.0.0): 6.0.0 [Compare Source](https://github.com/Hacker0x01/react-datepicker/compare/v5.1.0...v6.0.0) #### What's Changed - Upgrade date-fns to v3 by [@​ethanve](https://github.com/ethanve) in [https://github.com/Hacker0x01/react-datepicker/pull/4481](https://github.com/Hacker0x01/react-datepicker/pull/4481) - Switch workflows to Node 20 by [@​martijnrusschen](https://github.com/martijnrusschen) in [https://github.com/Hacker0x01/react-datepicker/pull/4490](https://github.com/Hacker0x01/react-datepicker/pull/4490) #### New Contributors - [@​ethanve](https://github.com/ethanve) made their first contribution in [https://github.com/Hacker0x01/react-datepicker/pull/4481](https://github.com/Hacker0x01/react-datepicker/pull/4481) **Full Changelog**: Hacker0x01/react-datepicker@v5.1.0...v6.0.0 ### [`v5.1.0`](https://github.com/Hacker0x01/react-datepicker/releases/tag/v5.1.0): 5.1.0 [Compare Source](https://github.com/Hacker0x01/react-datepicker/compare/v5.0.0...v5.1.0) #### What's Changed - Fix options passed to date-fns/parse by [@​emilecantin](https://github.com/emilecantin) in [https://github.com/Hacker0x01/react-datepicker/pull/4474](https://github.com/Hacker0x01/react-datepicker/pull/4474) **Full Changelog**: Hacker0x01/react-datepicker@v5.0.0...v5.1.0 ### [`v5.0.0`](https://github.com/Hacker0x01/react-datepicker/releases/tag/v5.0.0): 5.0.0 [Compare Source](https://github.com/Hacker0x01/react-datepicker/compare/v4.25.0...v5.0.0) #### Breaking changes - Migrate from Popper.js to Floating-UI by [@​G07cha](https://github.com/G07cha) in [https://github.com/Hacker0x01/react-datepicker/pull/4393](https://github.com/Hacker0x01/react-datepicker/pull/4393) #### What's Changed - 🐛 FIX: readability-isMonthinRange by [@​mary139](https://github.com/mary139) in [https://github.com/Hacker0x01/react-datepicker/pull/4421](https://github.com/Hacker0x01/react-datepicker/pull/4421) - Fix [#​4431](https://github.com/Hacker0x01/react-datepicker/issues/4431): Update the excludedDate to match the year to check of the isYearDisabled by [@​balajis-qb](https://github.com/balajis-qb) in [https://github.com/Hacker0x01/react-datepicker/pull/4432](https://github.com/Hacker0x01/react-datepicker/pull/4432) - Fix [#​4420](https://github.com/Hacker0x01/react-datepicker/issues/4420): Update home key and end key navigation in Calendar component by [@​balajis-qb](https://github.com/balajis-qb) in [https://github.com/Hacker0x01/react-datepicker/pull/4430](https://github.com/Hacker0x01/react-datepicker/pull/4430) - Document [#​4420](https://github.com/Hacker0x01/react-datepicker/issues/4420): 📝 Update the behavior of Home Key and End Key in the README file by [@​balajis-qb](https://github.com/balajis-qb) in [https://github.com/Hacker0x01/react-datepicker/pull/4438](https://github.com/Hacker0x01/react-datepicker/pull/4438) - Fix [#​4076](https://github.com/Hacker0x01/react-datepicker/issues/4076): Trigger onCalendarClose event and onChange even when the same date is selected as the start and the end date in a date range by [@​balajis-qb](https://github.com/balajis-qb) in [https://github.com/Hacker0x01/react-datepicker/pull/4394](https://github.com/Hacker0x01/react-datepicker/pull/4394) - Excluded dates message by [@​dvelazquez1282](https://github.com/dvelazquez1282) in [https://github.com/Hacker0x01/react-datepicker/pull/4437](https://github.com/Hacker0x01/react-datepicker/pull/4437) - Fix [#​4456](https://github.com/Hacker0x01/react-datepicker/issues/4456): Add shift+pageUp key and shift+pageDown key navigation in Calendar component by [@​balajis-qb](https://github.com/balajis-qb) in [https://github.com/Hacker0x01/react-datepicker/pull/4457](https://github.com/Hacker0x01/react-datepicker/pull/4457) - Fix options passed to date-fns/format by [@​emilecantin](https://github.com/emilecantin) in [https://github.com/Hacker0x01/react-datepicker/pull/4469](https://github.com/Hacker0x01/react-datepicker/pull/4469) #### New Contributors - [@​mary139](https://github.com/mary139) made their first contribution in [https://github.com/Hacker0x01/react-datepicker/pull/4421](https://github.com/Hacker0x01/react-datepicker/pull/4421) - [@​G07cha](https://github.com/G07cha) made their first contribution in [https://github.com/Hacker0x01/react-datepicker/pull/4393](https://github.com/Hacker0x01/react-datepicker/pull/4393) - [@​dvelazquez1282](https://github.com/dvelazquez1282) made their first contribution in [https://github.com/Hacker0x01/react-datepicker/pull/4437](https://github.com/Hacker0x01/react-datepicker/pull/4437) - [@​emilecantin](https://github.com/emilecantin) made their first contribution in [https://github.com/Hacker0x01/react-datepicker/pull/4469](https://github.com/Hacker0x01/react-datepicker/pull/4469) **Full Changelog**: Hacker0x01/react-datepicker@v4.25.0...v5.0.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/ASVGay/the-rhapsodies). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xNzMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjE3My4wIiwidGFyZ2V0QnJhbmNoIjoiZGV2In0=-->
BREAKING CHANGE: Require date-fns 4 BREAKING CHANGE: bump react-datepicker from v4 to v7 List of breaking changes: - v5: Hacker0x01/react-datepicker#4393 - v6: Hacker0x01/react-datepicker#4481 - v7: https://github.com/Hacker0x01/react-datepicker/releases/tag/v7.0.0 BREAKING CHANGE: remove includeTime prop in favor of showTimeSelect BREAKING CHANGE: remove timeLabel prop in favor of timeCaption Refs: CDS-206
Upgrades
date-fns
to their latest version.Changes that were needed: