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 a date in strict mode (with customParseFormat plugin) with timezone (ZZ / +0600) returns a date object which is not .isValid().
customParseFormat
.isValid()
const dayjs = require("dayjs"); const customParseFormat = require("dayjs/plugin/customParseFormat"); dayjs.extend(customParseFormat); const dateFormat = "YYYYMMDD HHmmss ZZ"; const date = dayjs("20241224 061500 +0600", dateFormat); console.log("date.isValid()", date.isValid()); // true console.log("isoString", date.toISOString()); // 2024-12-24T00:15:00.000Z const dateStrict = dayjs("20241224 061500 +0600", dateFormat, true); console.log("dateStrict.isValid()", dateStrict.isValid()); // false <---------- WRONG console.log("isoString", dateStrict.toISOString()); // throws RangeError: Invalid time value
Expected behavior
dateStrict.isValid()
dateStrict.toISOString()
RangeError: Invalid time value
2024-12-24T00:15:00.000Z
Information
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
Parsing a date in strict mode (with
customParseFormat
plugin) with timezone (ZZ / +0600) returns a date object which is not.isValid()
.Expected behavior
dateStrict.isValid()
should return truedateStrict.toISOString()
should not throwRangeError: Invalid time value
, it should return2024-12-24T00:15:00.000Z
Information
The text was updated successfully, but these errors were encountered: