iamkun / iamkun/dayjs

Millisecond part of ISO String duration being added twice

Open
#2,484 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**
This may or may not be related to #1652

When using an ISO duration string with a non-integer second value and adding it to a date, the millisecond part gets added twice. For example a duration of "PT0.1S" adds 200ms.

[Example Codepen](https://codepen.io/mrchimp/pen/WNPbBra)

**Expected behavior**
A duration of "PT0.1S" should add 100ms.

**Information**
- Day.js Version v1.11.10
- OS: Ubuntu
- Browser: Chrome 117.0.5938.149
- Time zone: GMT

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the reported ISO duration "PT0.1S" and the linked CodePen, then trace how ISO durations are parsed and added to dates. Done means the duration adds 100ms rather than 200ms, with a regression test covering the non-integer-second case.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
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.