iamkun / iamkun/dayjs

duration.minutes() not guaranteed to be in [0, 60)

Open
#2,329 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**

```
// actual
dayjs.duration({ minutes: 359 }).minutes() === 359
```

**Expected behavior**

```
// expected
dayjs.duration({ minutes: 359 }).minutes() === 59
```

Per https://day.js.org/docs/en/durations/minutes:
> As with the other getters for durations, `dayjs.duration().minutes()` gets the minutes (0 - 59).

**Information**
- version: `/dayjs@1.11.8` with `integrity: sha512-LcgxzFoWMEPO7ggRv1Y2N31hUf2R0Vj7fuy/m+Bg1K8rr+KAs1AEy4y9jd5DXe8pbHgX+srkHNS7TH6Q6ZhYeQ==`
- OS: Windows 11 Pro / OS build 22621.1702
- Browser: Chrome Version 114.0.5735.110 (Official Build) (64-bit)
- Time zone: GMT-07:00 DST (Pacific Daylight Time)

Contributor guide

Open the contributing guide

Research direction

Start by locating the duration implementation for the minutes() getter and any existing duration tests. Reproduce the reported 359-minute case, then add coverage showing that minutes() returns a value from 0 through 59 while preserving the expected duration behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.