iamkun / iamkun/dayjs

duration.humanize(): returns "a month" for `NaN`

Open
#3,006 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**

```console
> dayjs.duration(NaN).humanize()
"a month"
```

**Expected behavior**

```console
> dayjs.duration(NaN).humanize()
"invalid duration"
```

**Information**
- Day.js Version: 1.11.19
- OS: macOS 26.3
- Runtime: deno 2.6.9
- Time zone: GMT-06:00 CST (Central Standard Time)

Contributor guide

Open the contributing guide

Research direction

Reproduce the reported dayjs.duration(NaN).humanize() result and trace the humanize() implementation in the Day.js source. Confirm that the invalid input returns "invalid duration" and add or update coverage for this case if the relevant test location is found.

Written by the indexing model from the issue text.

Assessment

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