-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(date-fns): we update date-fns to version v2.0.0
affects: @datepicker-react/hooks, @datepicker-react/styled Because we updated date-fns to v2.0.0, we need to make some breaking changes: Date format: we use date-fns v2.0.0 date format Hooks: parseDate function: The function takes an additional parameter, namely a date. BREAKING CHANGE: date format, parseDate ISSUES CLOSED: #4
- Loading branch information
Showing
57 changed files
with
11,992 additions
and
4,861 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Migrating to 2.0.0 | ||
|
||
In version v2.0.0 we updated date-fns to 2.0.0. Therefore we need to make some breaking changes. | ||
|
||
- **Date formatting** [All formats](https://date-fns.org/v2.0.0/docs/format), | ||
[Popular mistakes](https://date-fns.org/v2.0.0/docs/Unicode-Tokens) | ||
|
||
```js | ||
// Before v2.0.0. | ||
const dayLabelFormatFn = (date) => format(date, 'DD') | ||
const weekdayLabelFormatFn = (date) => format(date, 'dd') | ||
const monthLabelFormatFn = (date) => format(date, 'MMMM YYYY') | ||
|
||
useMonth({ | ||
..., | ||
dayLabelFormat = dayLabelFormatFn, | ||
weekdayLabelFormat = weekdayLabelFormatFn, | ||
monthLabelFormat = monthLabelFormatFn, | ||
}) | ||
|
||
// v2.0.0. | ||
const dayLabelFormatFn = (date) => format(date, 'dd') | ||
const weekdayLabelFormatFn = (date) => format(date, 'eeeeee') | ||
const monthLabelFormatFn = (date) => format(date, 'MMMM yyyy') | ||
|
||
useMonth({ | ||
..., | ||
dayLabelFormat = dayLabelFormatFn, | ||
weekdayLabelFormat = weekdayLabelFormatFn, | ||
monthLabelFormat = monthLabelFormatFn, | ||
}) | ||
``` | ||
|
||
- **Hooks: parseDate function:** The function takes an additional parameter, namely a date. | ||
[Docs](https://date-fns.org/v2.0.0/docs/parse) | ||
|
||
```js | ||
// Before v2.0.0 | ||
parseDate('02/11/2014', 'MM/dd/yyyy') | ||
|
||
// v2.0.0 | ||
parseDate('02/11/2014', 'MM/dd/yyyy', new Date()) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.