iamkun / iamkun/dayjs

String + Format parse fails when string includes 'dddd'

Open
#1,789 2 comments 0 reactions 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**
Using the version on the dayjs website (via the web console), I can construct dates like `Tuesday Feb 1/22 ` with

```
date = dayjs(new Date())
date.format('dddd MMM D/YY')
```

But attempting to parse them with the same format string returns `Invalid Date`

```
dayjs('Tuesday Feb 1/22', 'dddd MMM D/YY')
```

**Expected behavior**

the parser would return a valid dayjs object

**Information**
- Day.js Version [e.g. v1.0.0]
on the dayjs docs website
- OS: [e.g. iOS]
mac
- Browser [e.g. chrome 62]
safari 15.2
- Time zone: [e.g. GMT-07:00 DST (Pacific Daylight Time)]

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the documented format and parse calls in the Day.js web console, then trace the parsing path used for the `dddd MMM D/YY` format. Done means parsing `Tuesday Feb 1/22` returns a valid Day.js object instead of `Invalid Date`.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.