-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
formatDate cannot parse valid value #1396
Comments
string |
We'll special case this since it's convenient to pass in string TS but just
be wary of the inconsistencies 🙂
…On Thu, Aug 8, 2019 at 12:28 AM Liem Do ***@***.***> wrote:
I get error RangeError: Invalid time value when passing the timestamp to
formatDate.
formatDate('2019-08-06T15:16:23.000Z')
However, this works fine:
formatdate(new Date('2019-08-06T15:16:23.000Z'))
Expected behavior
formatDate should be able to parse the timestamp
Current behavior
Get error RangeError: Invalid time value
Step to reproduce for BUG REPORT Your Environment
Executable Version
npm ls react-intl 3.1.1
npm ls react 16.8.6
npm --version 6.9.0
node --version 12.4.0
OS Version
macOS Mojave 10.14.5
Browser Version
Chrome 75.0.3770.142
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1396>,
or mute the thread
</~https://github.com/notifications/unsubscribe-auth/AABQM32UT7K2QO4GQZX3G6DQDOOG5ANCNFSM4IKGHYRQ>
.
|
github-merge-queue bot
pushed a commit
that referenced
this issue
Jan 2, 2025
This PR allows strings in `formatDateTimeRange`. The reason for this is consistency. Back in 2019, we added this to `formatDate` and `formatTime`. Here are the issue and commits that originated this change: - Issue: #1396 - Comit: aed8c68#diff-41c7b3ac268a3a1ae5c7be92f1230f600013b7170e44a693570ccbdb183ea36bR95 Also, if you check the documentation on `formatDateTimeRange`, you would be lead to error: ![image](/~https://github.com/user-attachments/assets/e41e9e37-9910-43ac-90cf-ad6e49aa6ec1) Even though we see `number | Date | string`, strings don't work. Right now we get error: ``` Uncaught Error: [@formatjs/intl Error FORMAT_ERROR] Error formatting date time range. Locale: en-us Invalid time value RangeError: Invalid time value ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I get error
RangeError: Invalid time value
when passing the timestamp toformatDate
.However, this works fine:
Expected behavior
formatDate should be able to parse the timestamp
Current behavior
Get error
RangeError: Invalid time value
Step to reproduce for BUG REPORT
Your Environment
npm ls react-intl
npm ls react
npm --version
node --version
The text was updated successfully, but these errors were encountered: