iamkun / iamkun/dayjs

customParseFormat strict cannot parse 1-2 digit milliseconds

Open
#1,331 5 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
48.7k
Forks
2.8k
PR merge metrics
No merged PRs in 30d

Description

When using customParseFormat with strict mode enabled cannot parse milliseconds in 1-, 2-digit (S or SS pattern). Results in "Invalid Date".
Only 3-digits are parsed fine.
YYYY-MM-DDTHH:mm:ss.SSS pattern is OK
YYYY-MM-DDTHH:mm:ss.SS and YYYY-MM-DDTHH:mm:ss.S patterns are not OK

See jsfiddle: https://jsfiddle.net/4t5yk0ju/1/

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the customParseFormat plugin and reproduce the jsfiddle case using strict mode with S, SS, and SSS millisecond patterns. Compare the parsing behavior for one-, two-, and three-digit milliseconds, and consider the issue done when the first two forms parse successfully without regressing the three-digit case.

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
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.