Wrong validation check for strict mode in customParseFormat
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Please, added the test to `test/plugin/customParseFormat.test.js`:
```
expect(dayjs('2024-02-27T16:12:32.000-05:00', 'YYYY-MM-DDTHH:mm:ss.SSSZ', true).isValid()).toBe(true)
```
Problem is in comparison in file: `src/plugin/customParseFormat/index.js`
```
if (isStrict && date != this.format(format)) {
this.$d = new Date('')
}
```
date = `2024-02-27T16:12:32.000-05:00`
this.format(format) = `2024-02-28T00:12:32.000+03:00`
To me it seems that *strict check* should move to parsing part, not the post-parsing validation, as we miss original time zone.
What do you think?
I might try to make a PR
**Expected behavior**
Expected, that this date should be valid
**Information**
- Day.js Version v1.11.7
- OS: MacOS
- Browser v1.49.132
- Time zone: UTC+03:00
Contributor guide
Assessment
This issue has not been assessed yet.