Inconsistent behavior of dayjs.max and dayjs.min
Open
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
```
const dates = [dayjs()];
dayjs.max(...dates); // == null
dayjs.max(dates); // == date
```
And the same for dayjs.min.
I think it's weird that it returns different values for different types of arguments passing
**Expected behavior**
I think it shoud return datejs instance in both cases
**Information**
- Day.js Version 1.8.28
- OS: MacOS
- Browser chrome 87
Contributor guide
Research direction
Start by reproducing the reported dayjs.max and dayjs.min calls with a one-item array passed both directly and via spread. Then inspect the max/min API implementation and verify that both invocation forms return a Day.js instance, with tests covering each form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100