iamkun / iamkun/dayjs

Duration from ISO String with milliseconds doesn't set milliseconds

Open
#1,652 0 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**
Creating a duration from an ISO String doesn't set the milliseconds in the duration object.
`dayjs.duration("P4DT12H30M17.899S")`
returns
`{ years: 0, months: 0, weeks: 0, days: 4, hours: 12, minutes: 30, seconds: 17.899 }`

**Expected behavior**
The milliseconds will be set
`{ years: 0, months: 0, weeks: 0, days: 4, hours: 12, minutes: 30, seconds: 17, milliseconds: 899 }`

**Information**
- Day.js Version v1.10.7

Contributor guide

Open the contributing guide

Research direction

Start by running the reported dayjs.duration("P4DT12H30M17.899S") expression and trace the duration parsing entry point. Confirm that the resulting object separates seconds from milliseconds as shown in the expected behavior, then verify the same case with the project's relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.