Skip to content

Commit 12ad743

Browse files
bradevanskossnocorp
authored andcommitted
Clarifies that strings are still allowed as arguments, but not when a date is expected.
1 parent 464c8fd commit 12ad743

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

docs/upgradeGuide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ See [Unicode Tokens doc](https://date-fns.org/docs/Unicode-Tokens) for more deta
2424

2525
### String arguments
2626

27-
Functions now don't accept strings as arguments. Strings should
27+
Functions now don't accept strings as date arguments. Strings should
2828
be parsed using `parseISO` (ISO 8601) or `parse`.
2929

3030
See [this post](https://blog.date-fns.org/post/we-cut-date-fns-v2-minimal-build-size-down-to-300-bytes-and-now-its-the-smallest-date-library-18f2nvh2z0yal) for more details.

src/toDate/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export default function toDate(argument) {
5151
) {
5252
// eslint-disable-next-line no-console
5353
console.warn(
54-
"Starting with v2.0.0-beta.1 date-fns doesn't accept strings as arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"
54+
"Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"
5555
)
5656
// eslint-disable-next-line no-console
5757
console.warn(new Error().stack)

src/toDate/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe('toDate', () => {
4141
assert(
4242
// eslint-disable-next-line no-console
4343
console.warn.calledWith(
44-
"Starting with v2.0.0-beta.1 date-fns doesn't accept strings as arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"
44+
"Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"
4545
)
4646
)
4747
})

0 commit comments

Comments
 (0)