iamkun / iamkun/dayjs

CustomParseFormat does not parse UTC offset in strict mode

Open
#2,741 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
48.7k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

**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**
- Day.js Version: 1.11.13
- OS: Windows 10
- Browser: NodeJs v20.17.0
- Time zone: Europe/Warsaw UTC+2

Contributor guide

Open the contributing guide

Research direction

Start with the reported CustomParseFormat reproduction and compare the non-strict and strict parsing paths for the `Z` UTC offset. Add a regression test for `05/02/69 1:02:03 PM -05:00` with strict mode, and consider the issue done when both assertions pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.