iamkun / dayjs

⏰ Day.js 2kB immutable date-time library alternative to Moment.js with the same modern API
https://day.js.org
MIT License
47.05k stars 2.31k forks source link

CustomParseFormat does not parse UTC offset in strict mode #2741

Open cvbge opened 1 month ago

cvbge commented 1 month ago

Describe the bug

// From CustomParseFormat documentation, assertion passes:
assert(dayjs("05/02/69 1:02:03 PM -05:00", "MM/DD/YY H:mm:ss A Z").isValid())

// Same example but with strict=true, assertion fails:
assert(dayjs("05/02/69 1:02:03 PM -05:00", "MM/DD/YY H:mm:ss A Z", true).isValid())

Expected behavior Both should pass

Information