We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug Parsing date using dayJs and then converting to native JavaScript Date is not working as expected in Firefox browser.
const parsedDate = dayJs( "25-MAY-2021 12:00 +08:00", "DD-MMM-YYYY HH:mm Z" ).toDate().toString();
Output Getting below output in Firefox browser
Fri May 25 -2021 09:53:28 GMT+0553 (India Standard Time)
Expected output In chrome and NodeJs, getting correct below output
Tue May 25 2021 09:30:00 GMT+0530 (India Standard Time)
Issues:
Could this be related to Firefox bug Inconsistent date object - Negative year in result ?
Information
Issue reproduce I have created minimal repo to reproduce above issues https://codesandbox.io/s/determined-mayer-fsc4e?file=/src/index.js
Anyone aware of possible workarounds ?
The text was updated successfully, but these errors were encountered:
I've noticed the same issue with Moment on Firefox. Scary
import * as moment from 'moment' moment( "25-MAY-2021 12:00" ).format("YYYY-MM-dddd HH:mm:ss") // chrome: "2021-05-Tuesday 12:00:00" // firefox: "-2021-05-Friday 12:00:00"
Anyway, there is a workaround with the customParseFormat plugin:
import * as customParseFormat from 'dayjs/plugin/customParseFormat' import * as dayjs from 'dayjs' dayjs.extend(customParseFormat) const date = dayjs('2021-05-25 12:00 PM', 'YYYY-MM-DD HH:mm A').toDate().toString() // "Tue May 25 2021 12:00:00 GMT+0200 (Central European Summer Time)"
and the output is the same across browsers. More on that here. Cheers!
Sorry, something went wrong.
For consistent results parsing anything other than ISO 8601 strings, you should use String + Format.
ref https://day.js.org/docs/en/parse/string
No branches or pull requests
Describe the bug
Parsing date using dayJs and then converting to native JavaScript Date is not working as expected in Firefox browser.
Output
Getting below output in Firefox browser
Expected output
In chrome and NodeJs, getting correct below output
Issues:
Could this be related to Firefox bug Inconsistent date object - Negative year in result ?
Information
Issue reproduce
I have created minimal repo to reproduce above issues https://codesandbox.io/s/determined-mayer-fsc4e?file=/src/index.js
Anyone aware of possible workarounds ?
The text was updated successfully, but these errors were encountered: