iamkun / iamkun/dayjs

An unexpected type returned from dayjs.minMax when called with empty array - revisit

Open
#2,279 0 comments 1 reaction 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

An empty array is very unexpected here:

typeof dayjs.max([]) === 'array'; // true

there's an example:

https://jsfiddle.net/7y5f6r3g/1/

Expected behavior

I know this is already been raised in #1061 but changes done for this fix doesn't seems correct to me, be should written dayjs object when argument is an empty array and null when passing null.

Information

Day.js Version 1.8.36
OS: OSX
Browser Chrome

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.