Repository: iamkun/dayjs
Pull request #2330 (2023-06-09 18:43:34)

Fix/minMax
### Motivation:
If I automatically get a list of dates from somewhere, that list might contain 'nulls', or even just return a single valid argument. At the moment, if not treated, the user will receive a TypeError or 'null' as a return, even with valid arguments.

### Makes two adjustments:
- If an array has a 'null' arg, doesnt return a TypeError, now just ignore the 'null' args and consider the others:

Example:
```
Before this alteration:
dayjs.max(dayjs("1995-03-16"), null, dayjs("2023-03-16")).format()
---> TypeError: Cannot read properties of null (reading 'isValid')

After:
dayjs.max(dayjs("1995-03-16"), null, dayjs("2023-03-16")).format()
---> 2023-03-16T00:00:00-03:00
```

- The second adjustment is when provided just one arg, instead of returning null, it returns the only given value.

Example:
```
Before this alteration:
dayjs.max(dayjs("1995-03-16"))
---> null

After:
dayjs.max(dayjs("1995-03-16"), null, dayjs("2023-03-16")).format()
---> 1995-03-16T00:00:00-03:00
```

I also added some tests to validate this propose.

dchueri: https://github.com/iamkun/dayjs/issues/2306

Patch:
diff --git a/.editorconfig b/.editorconfig
index 14c1d8c..d4d73cf 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -4,3 +4,4 @@ root = true
 charset = utf-8
 end_of_line = lf
 insert_final_newline = true
+indent_size = 2
diff --git a/README.md b/README.md
index ca0443f..3a855a9 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-English | [简体中文](./docs/zh-cn/README.zh-CN.md) | [日本語](./docs/ja/README-ja.md) | [Português Brasileiro](./docs/pt-br/README-pt-br.md) | [한국어](./docs/ko/README-ko.md) | [Español (España)](./docs/es-es/README-es-es.md) | [Русский](./docs/ru/README-ru.md) | [Türkçe](./docs/tr/README-tr.md) | [සිංහල](./docs/si/README-si.md)
+English | [简体中文](./docs/zh-cn/README.zh-CN.md) | [日本語](./docs/ja/README-ja.md) | [Português Brasileiro](./docs/pt-br/README-pt-br.md) | [한국어](./docs/ko/README-ko.md) | [Español (España)](./docs/es-es/README-es-es.md) | [Русский](./docs/ru/README-ru.md) | [Türkçe](./docs/tr/README-tr.md) | [සිංහල](./docs/si/README-si.md) | [עברית](./docs/he/README-he.md)
 
 <p align="center"><a href="https://day.js.org/" target="_blank" rel="noopener noreferrer"><img width="550"
                                                                              src="https://user-images.githubusercontent.com/17680888/39081119-3057bbe2-456e-11e8-862c-646133ad4b43.png"
diff --git a/docs/es-es/README-es-es.md b/docs/es-es/README-es-es.md
index ae190e8..cd16857 100644
--- a/docs/es-es/README-es-es.md
+++ b/docs/es-es/README-es-es.md
@@ -1,4 +1,4 @@
-Español (España) | [English](../../README.md) | [简体中文](../zh-cn/README.zh-CN.md) | [日本語](../ja/README-ja.md) | [Português Brasileiro](../pt-br/README-pt-br.md) | [한국어](../ko/README-ko.md) | [Русский](../ru/README-ru.md)
+Español (España) | [English](../../README.md) | [简体中文](../zh-cn/README.zh-CN.md) | [日本語](../ja/README-ja.md) | [Português Brasileiro](../pt-br/README-pt-br.md) | [한국어](../ko/README-ko.md) | [Русский](../ru/README-ru.md) | [עברית](./docs/he/README-he.md) 
 
 <p align="center"><a href="https://day.js.org/" target="_blank" rel="noopener noreferrer"><img width="550"
                                                                              src="https://user-images.githubusercontent.com/17680888/39081119-3057bbe2-456e-11e8-862c-646133ad4b43.png"
diff --git a/docs/he/README-he.md b/docs/he/README-he.md
new file mode 100644
index 0000000..aeb0419
--- /dev/null
+++ b/docs/he/README-he.md
@@ -0,0 +1,171 @@
+<div dir="rtl">
+
+עברית | [English](../../README.md)  | [简体中文](./docs/zh-cn/README.zh-CN.md) | [日本語](./docs/ja/README-ja.md) | [Português Brasileiro](./docs/pt-br/README-pt-br.md) | [한국어](./docs/ko/README-ko.md) | [Español (España)](./docs/es-es/README-es-es.md) | [Русский](./docs/ru/README-ru.md) | [Türkçe](./docs/tr/README-tr.md) | [සිංහල](./docs/si/README-si.md)
+
+<p align="center"><a href="https://day.js.org/" target="_blank" rel="noopener noreferrer"><img width="550"
+                                                                             src="https://user-images.githubusercontent.com/17680888/39081119-3057bbe2-456e-11e8-862c-646133ad4b43.png"
+                                                                             alt="Day.js"></a></p>
+<p align="center">אלטרנטיבה מהירה ל-Moment.js ששוקלת רק <b>2kB</b> עם אותן יכולות מודרניות</p>
+<p align="center">
+    <a href="https://unpkg.com/dayjs/dayjs.min.js"><img
+            src="https://img.badgesize.io/https://unpkg.com/dayjs/dayjs.min.js?compression=gzip&style=flat-square"
+            alt="Gzip Size"></a>
+    <a href="https://www.npmjs.com/package/dayjs"><img src="https://img.shields.io/npm/v/dayjs.svg?style=flat-square&colorB=51C838"
+                                                       alt="NPM Version"></a>
+    <a href="https://travis-ci.com/iamkun/dayjs"><img
+            src="https://img.shields.io/travis/iamkun/dayjs/master.svg?style=flat-square" alt="Build Status"></a>
+    <a href="https://codecov.io/gh/iamkun/dayjs"><img
+            src="https://img.shields.io/codecov/c/github/iamkun/dayjs/master.svg?style=flat-square" alt="Codecov"></a>
+    <a href="https://github.com/iamkun/dayjs/blob/master/LICENSE"><img
+            src="https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square" alt="License"></a>
+    <br>
+    <a href="https://saucelabs.com/u/dayjs">
+        <img width="750" src="https://user-images.githubusercontent.com/17680888/40040137-8e3323a6-584b-11e8-9dba-bbe577ee8a7b.png" alt="Sauce Test Status">
+    </a>
+</p>
+
+> Day.js היא ספרייה מינימלסטית לפענוח, אימות, מניפולציה והצגה של תאריכים ושעות לדפדפנים מודרנים עם תאימות גבוהה ל-API של Moment.js. אם השתמשתם ב-Moment.js, אתם כבר יודעים את Day.js 
+
+<div dir="ltr">
+
+```js
+dayjs().startOf('month').add(1, 'day').set('year', 2018).format('YYYY-MM-DD HH:mm:ss');
+```
+
+</div>
+
+* 🕒 תבניות ו-API זהים ל-Moment.js
+* 💪 אינו ניתן לשינוי
+* 🔥 ניתן לשרשור
+* 🌐 תמיכה ב-I18n
+* 📦 ספרייה קטנטנה 2kb
+* 👫 נתמכת בכל הדפדפנים
+
+---
+
+## צעדים ראשונים 
+
+### דוקומנטצייה 
+באתר [day.js.org](https://day.js.org/) ניתן למצוא פרטים נוספים, API, ותיעודים נוספים.
+
+
+### התקנה 
+
+```console
+npm install dayjs --save
+```
+
+📚[מדריך התקנה](https://day.js.org/docs/en/installation/installation)
+
+### API
+מאוד קל להשתמש ב-Day.js לפענוח, אימות, מניפולציה והצגה של תאריכים ושעות. 
+
+<div dir="ltr">
+
+
+```javascript
+dayjs('2018-08-08') // פענוח
+
+dayjs().format('{YYYY} MM-DDTHH:mm:ss SSS [Z] A') // הצגה
+
+dayjs().set('month', 3).month() // קבלה והגדרה
+
+dayjs().add(1, 'year') // מניפולציה
+
+dayjs().isBefore(dayjs()) // שאילתה
+```
+
+</div>
+
+📚[תיעודי API](https://day.js.org/docs/en/parse/parse)
+
+### I18n
+ל-Day.js יש תמיכה מצוינית בבינלאומיות.
+
+אבל אף אחד מהם לא יכלל בקובץ הסופי אלא אם כן יתבצע בהם שימוש.
+
+<div dir="ltr">
+
+
+```javascript
+import 'dayjs/locale/es' // טעינה לפי הצורך
+
+dayjs.locale('es') // הגדרה לשימוש בספרדית באופן גלובלאלי
+
+dayjs('2018-05-05').locale('zh-cn').format() // הגדרה לשימוש בסינית פשוטה למופע ספיציפי בלבד
+```
+
+</div>
+
+
+📚[בינלאומיות](https://day.js.org/docs/en/i18n/i18n)
+
+### תוסף
+
+תוסף הוא מודל בלתי-תלוי הניתן להוספה ל-Day.js להרחבה או להוספה של פונקציות.
+
+
+<div dir="ltr">
+
+
+```javascript
+import advancedFormat from 'dayjs/plugin/advancedFormat' //  טעינה לפי הצורך
+
+dayjs.extend(advancedFormat) // שימוש בתוסף
+
+dayjs().format('Q Do k kk X x') // כעת יותר אפשרויות זמינות
+```
+
+</div>
+
+📚[רשימת תוספים](https://day.js.org/docs/en/plugin/plugin)
+
+## ספונסרים 
+תמכו בפרויקט זה כדי להיות ספונסר. קבלו לוגו עם קישור לאתר שלכם שיופיע כאן. 
+
+
+[[תמיכה דרך Github](https://github.com/sponsors/iamkun/)] [[תמיכה דרך OpenCollective](https://opencollective.com/dayjs#sponsor)]
+
+<a href="https://toyokumo.co.jp" target="_blank">
+  <img width="70" src="https://user-images.githubusercontent.com/17680888/197092231-2367b5eb-1e43-467e-a311-23f7cd97b086.png">
+</a>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+<a href="https://github.com/alan-eu" target="_blank">
+  <img width="70" src="https://avatars.githubusercontent.com/u/18175329?s=52&v=4">
+</a>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+<a href="https://opencollective.com/sight-and-sound-ministries" target="_blank">
+  <img width="70" src="https://user-images.githubusercontent.com/17680888/232316426-cb99b4cf-0ccb-4e73-a6ce-e16dba6aadf4.png">
+</a>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+<a href="https://www.exoflare.com/open-source/?utm_source=dayjs&utm_campaign=open_source" target="_blank">
+  <img width="70" src="https://user-images.githubusercontent.com/17680888/162761622-1407a849-0c41-4591-8aa9-f98114ec2092.png">
+</a>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+<a href="https://rxdb.info/?utm_source=day.js.org&utm_medium=banner&utm_campaign=day.js.org-sponsored" target="_blank"><img width="70" src="https://user-images.githubusercontent.com/17680888/200301812-9c9bd523-5dc4-4cab-b380-543fbcd3802c.svg"></a>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+<a href="https://github.com/vendure-ecommerce" target="_blank"><img width="70" src="https://avatars.githubusercontent.com/u/39629390?s=52&v=4"></a>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+<a href="https://opencollective.com/docbot" target="_blank"><img width="70" src="https://images.opencollective.com/docbot/457761e/logo.png"></a>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+<a href="https://opencollective.com/datawrapper" target="_blank"><img width="70" src="https://images.opencollective.com/datawrapper/c13e229/logo.png"></a>
+
+## תורמים 
+
+פרויקט זה קיים הודות לכל האנשים שתמכו בו.
+
+תנו לנו 💖 כוכב 💖 כדי לתמוך בנו. תודה רבה.
+
+ותודה רבה לכל התומכים שלנו! 🙏
+
+<a href="https://opencollective.com/dayjs/backer/0/website?requireActive=false" target="_blank"><img width="35" src="https://opencollective.com/dayjs/backer/0/avatar.svg?requireActive=false"></a>
+<a href="https://opencollective.com/dayjs/backer/1/website?requireActive=false" target="_blank"><img width="35" src="https://opencollective.com/dayjs/backer/1/avatar.svg?requireActive=false"></a>
+<a href="https://opencollective.com/dayjs/backer/2/website?requireActive=false" target="_blank"><img width="35" src="https://opencollective.com/dayjs/backer/2/avatar.svg?requireActive=false"></a>
+<a href="https://opencollective.com/dayjs/backer/3/website?requireActive=false" target="_blank"><img width="35" src="https://opencollective.com/dayjs/backer/3/avatar.svg?requireActive=false"></a>
+<br />
+<a href="https://opencollective.com/dayjs#backers" target="_blank"><img src="https://opencollective.com/dayjs/contributors.svg?width=890" /></a>
+
+## רישיון 
+
+Day.js מורשה לשימוש עם [רישיון MIT](./LICENSE).
+</div>
diff --git a/docs/ja/README-ja.md b/docs/ja/README-ja.md
index b40ceeb..a708a03 100644
--- a/docs/ja/README-ja.md
+++ b/docs/ja/README-ja.md
@@ -1,4 +1,4 @@
-日本語 | [English](../../README.md) | [简体中文](../zh-cn/README.zh-CN.md) | [Português Brasileiro](../pt-br/README-pt-br.md) | [한국어](../ko/README-ko.md) | [Español (España)](../es-es/README-es-es.md) | [Русский](../ru/README-ru.md)
+日本語 | [English](../../README.md) | [简体中文](../zh-cn/README.zh-CN.md) | [Português Brasileiro](../pt-br/README-pt-br.md) | [한국어](../ko/README-ko.md) | [Español (España)](../es-es/README-es-es.md) | [Русский](../ru/README-ru.md)| [עברית](./docs/he/README-he.md)
 
 <p align="center"><a href="https://day.js.org/" target="_blank" rel="noopener noreferrer"><img width="550"
                                                                              src="https://user-images.githubusercontent.com/17680888/39081119-3057bbe2-456e-11e8-862c-646133ad4b43.png"
diff --git a/docs/ko/README-ko.md b/docs/ko/README-ko.md
index 7d6228d..4389cc3 100644
--- a/docs/ko/README-ko.md
+++ b/docs/ko/README-ko.md
@@ -1,4 +1,4 @@
-한국어 | [English](../../README.md) | [简体中文](../zh-cn/README.zh-CN.md) | [日本語](../ja/README-ja.md) | [Português Brasileiro](../pt-br/README-pt-br.md) | [Español (España)](../es-es/README-es-es.md) | [Русский](../ru/README-ru.md)
+한국어 | [English](../../README.md) | [简体中文](../zh-cn/README.zh-CN.md) | [日本語](../ja/README-ja.md) | [Português Brasileiro](../pt-br/README-pt-br.md) | [Español (España)](../es-es/README-es-es.md) | [Русский](../ru/README-ru.md)| [עברית](./docs/he/README-he.md)
 
 <p align="center"><a href="https://day.js.org/" target="_blank" rel="noopener noreferrer"><img width="550"
                                                                              src="https://user-images.githubusercontent.com/17680888/39081119-3057bbe2-456e-11e8-862c-646133ad4b43.png"
diff --git a/docs/pt-br/README-pt-br.md b/docs/pt-br/README-pt-br.md
index 4923fa5..f41fb3b 100644
--- a/docs/pt-br/README-pt-br.md
+++ b/docs/pt-br/README-pt-br.md
@@ -1,4 +1,4 @@
-Português Brasileiro | [English](../../README.md) | [简体中文](../zh-cn/README.zh-CN.md) | [日本語](../ja/README-ja.md) | [한국어](../ko/README-ko.md) | [Español (España)](../es-es/README-es-es.md) | [Русский](../ru/README-ru.md)
+Português Brasileiro | [English](../../README.md) | [简体中文](../zh-cn/README.zh-CN.md) | [日本語](../ja/README-ja.md) | [한국어](../ko/README-ko.md) | [Español (España)](../es-es/README-es-es.md) | [Русский](../ru/README-ru.md)| [עברית](./docs/he/README-he.md)
 
 <p align="center"><a href="https://day.js.org/" target="_blank" rel="noopener noreferrer"><img width="550"
                                                                              src="https://user-images.githubusercontent.com/17680888/39081119-3057bbe2-456e-11e8-862c-646133ad4b43.png"
diff --git a/docs/ru/README-ru.md b/docs/ru/README-ru.md
index c8f9b83..1ebb05c 100644
--- a/docs/ru/README-ru.md
+++ b/docs/ru/README-ru.md
@@ -1,4 +1,4 @@
-Русский | [English](../../README.md) | [简体中文](../zh-cn/README.zh-CN.md) | [日本語](../ja/README-ja.md) | [Português Brasileiro](../pt-br/README-pt-br.md) | [한국어](../ko/README-ko.md) | [Español (España)](../es-es/README-es-es.md)
+Русский | [English](../../README.md) | [简体中文](../zh-cn/README.zh-CN.md) | [日本語](../ja/README-ja.md) | [Português Brasileiro](../pt-br/README-pt-br.md) | [한국어](../ko/README-ko.md) | [Español (España)](../es-es/README-es-es.md)| [עברית](./docs/he/README-he.md)
 
 <p align="center"><a href="https://day.js.org/ru/" target="_blank" rel="noopener noreferrer"><img width="550"
                                                                              src="https://user-images.githubusercontent.com/17680888/39081119-3057bbe2-456e-11e8-862c-646133ad4b43.png"
diff --git a/docs/si/README-si.md b/docs/si/README-si.md
index 3737b76..37f6f20 100644
--- a/docs/si/README-si.md
+++ b/docs/si/README-si.md
@@ -1,4 +1,4 @@
-සිංහල | [English](../../README.md) | [简体中文](./docs/zh-cn/README.zh-CN.md) | [日本語](./docs/ja/README-ja.md) | [Português Brasileiro](./docs/pt-br/README-pt-br.md) | [한국어](./docs/ko/README-ko.md) | [Español (España)](./docs/es-es/README-es-es.md) | [Русский](./docs/ru/README-ru.md) | [Türkçe](./docs/tr/README-tr.md)
+සිංහල | [English](../../README.md) | [简体中文](./docs/zh-cn/README.zh-CN.md) | [日本語](./docs/ja/README-ja.md) | [Português Brasileiro](./docs/pt-br/README-pt-br.md) | [한국어](./docs/ko/README-ko.md) | [Español (España)](./docs/es-es/README-es-es.md) | [Русский](./docs/ru/README-ru.md) | [Türkçe](./docs/tr/README-tr.md)| [עברית](./docs/he/README-he.md)
 
 <p align="center"><a href="https://day.js.org/" target="_blank" rel="noopener noreferrer"><img width="550"
                                                                              src="https://user-images.githubusercontent.com/17680888/39081119-3057bbe2-456e-11e8-862c-646133ad4b43.png"
diff --git a/docs/tr/README-tr.md b/docs/tr/README-tr.md
index c5d8840..ebf4dcf 100644
--- a/docs/tr/README-tr.md
+++ b/docs/tr/README-tr.md
@@ -1,4 +1,4 @@
-Türkçe | [English](../../README.md) | [简体中文](../zh-cn/README.zh-CN.md) | [日本語](../ja/README-ja.md) | [Português Brasileiro](../pt-br/README-pt-br.md) | [한국어](../ko/README-ko.md) | [Español (España)](../es-es/README-es-es.md) | [Русский](../ru/README-ru.md)
+Türkçe | [English](../../README.md) | [简体中文](../zh-cn/README.zh-CN.md) | [日本語](../ja/README-ja.md) | [Português Brasileiro](../pt-br/README-pt-br.md) | [한국어](../ko/README-ko.md) | [Español (España)](../es-es/README-es-es.md) | [Русский](../ru/README-ru.md)| [עברית](./docs/he/README-he.md)
 
 <p align="center"><a href="https://day.js.org/" target="_blank" rel="noopener noreferrer"><img width="550"
                                                                              src="https://user-images.githubusercontent.com/17680888/39081119-3057bbe2-456e-11e8-862c-646133ad4b43.png"
@@ -133,4 +133,4 @@ Ve tüm destekçilerimize teşekkür ederiz! 🙏
 
 ## Lisans
 
-Day.js, bir [MIT Lisansı](../../LICENSE) altında lisanslanmıştır.
\ No newline at end of file
+Day.js, bir [MIT Lisansı](../../LICENSE) altında lisanslanmıştır.
diff --git a/src/index.js b/src/index.js
index ba74b8b..5b4c464 100644
--- a/src/index.js
+++ b/src/index.js
@@ -319,18 +319,38 @@ class Dayjs {
     const that = dayjs(input)
     const zoneDelta = (that.utcOffset() - this.utcOffset()) * C.MILLISECONDS_A_MINUTE
     const diff = this - that
-    let result = Utils.m(this, that)
-
-    result = {
-      [C.Y]: result / 12,
-      [C.M]: result,
-      [C.Q]: result / 3,
-      [C.W]: (diff - zoneDelta) / C.MILLISECONDS_A_WEEK,
-      [C.D]: (diff - zoneDelta) / C.MILLISECONDS_A_DAY,
-      [C.H]: diff / C.MILLISECONDS_A_HOUR,
-      [C.MIN]: diff / C.MILLISECONDS_A_MINUTE,
-      [C.S]: diff / C.MILLISECONDS_A_SECOND
-    }[unit] || diff // milliseconds
+    const getMonth = () => Utils.m(this, that)
+
+    let result
+    switch (unit) {
+      case C.Y:
+        result = getMonth() / 12
+        break
+      case C.M:
+        result = getMonth()
+        break
+      case C.Q:
+        result = getMonth() / 3
+        break
+      case C.W:
+        result = (diff - zoneDelta) / C.MILLISECONDS_A_WEEK
+        break
+      case C.D:
+        result = (diff - zoneDelta) / C.MILLISECONDS_A_DAY
+        break
+      case C.H:
+        result = diff / C.MILLISECONDS_A_HOUR
+        break
+      case C.MIN:
+        result = diff / C.MILLISECONDS_A_MINUTE
+        break
+      case C.S:
+        result = diff / C.MILLISECONDS_A_SECOND
+        break
+      default:
+        result = diff // milliseconds
+        break
+    }
 
     return float ? result : Utils.a(result)
   }
diff --git a/src/plugin/minMax/index.js b/src/plugin/minMax/index.js
index f515c60..8b3e2d3 100644
--- a/src/plugin/minMax/index.js
+++ b/src/plugin/minMax/index.js
@@ -1,12 +1,18 @@
 export default (o, c, d) => {
   const sortBy = (method, dates) => {
-    if (!dates || !dates.length || !dates[0] || (dates.length === 1 && !dates[0].length)) {
+    if (
+      !dates ||
+      !dates.length ||
+      (dates.length === 1 && !dates[0]) ||
+      (dates.length === 1 && Array.isArray(dates[0]) && !dates[0].length)
+    ) {
       return null
     }
     if (dates.length === 1 && dates[0].length > 0) {
       [dates] = dates
     }
-    let result
+    dates = dates.filter(date => date)
+    let result;
     [result] = dates
     for (let i = 1; i < dates.length; i += 1) {
       if (!dates[i].isValid() || dates[i][method](result)) {
diff --git a/src/plugin/objectSupport/index.js b/src/plugin/objectSupport/index.js
index 6501666..bd32358 100644
--- a/src/plugin/objectSupport/index.js
+++ b/src/plugin/objectSupport/index.js
@@ -1,6 +1,6 @@
 export default (o, c, dayjs) => {
   const proto = c.prototype
-  const isObject = obj => !(obj instanceof Date) && !(obj instanceof Array)
+  const isObject = obj => obj !== null && !(obj instanceof Date) && !(obj instanceof Array)
         && !proto.$utils().u(obj) && (obj.constructor.name === 'Object')
   const prettyUnit = (u) => {
     const unit = proto.$utils().p(u)


Test patch:
diff --git a/test/display.test.js b/test/display.test.js
index 86a978d..ce1f478 100644
--- a/test/display.test.js
+++ b/test/display.test.js
@@ -264,11 +264,7 @@ it('As ISO 8601 String -> toISOString e.g. 2013-02-04T22:44:30.652Z', () => {
 it('Year 1 formatted with YYYY should pad with zeroes', () => {
   const date = new Date(1, 0, 1)
   date.setUTCFullYear(1) // Required because 0-99 are parsed as 19xx in JS: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date#year
-  expect(dayjs(date).format('YYYY')).toBe('0001')
-})
-
-it('Year 1 formatting matches moment format', () => {
-  const date = new Date(1, 0, 1)
-  date.setUTCFullYear(1)
-  expect(dayjs(date).format('YYYY')).toBe(moment(date).format('YYYY'))
+  const res = dayjs(date).format('YYYY')
+  expect(res.slice(0, 3)).toBe('000') // because of timezone, the result might be 0000 0001 or 0002
+  expect(res).toBe(moment(date).format('YYYY'))
 })
diff --git a/test/plugin/minMax.test.js b/test/plugin/minMax.test.js
index eeef920..f8a5080 100644
--- a/test/plugin/minMax.test.js
+++ b/test/plugin/minMax.test.js
@@ -55,3 +55,17 @@ it('If Invalid Date return Invalid Date', () => {
   expect(dayjs.min([arg1, arg2, arg3, arg4]).format())
     .toBe(arg4.format())
 })
+
+it('Ignore if exists an "null" argument', () => {
+  expect(dayjs.max(null, null, arg1, arg2, null, arg3).format())
+    .toBe(arg1.format())
+  expect(dayjs.min([null, null, arg1, arg2, null, arg3]).format())
+    .toBe(arg3.format())
+})
+
+it('Return the only date if just provided one argument', () => {
+  expect(dayjs.max(arg1).format())
+    .toBe(arg1.format())
+  expect(dayjs.min([arg1]).format())
+    .toBe(arg1.format())
+})
diff --git a/test/plugin/objectSupport.test.js b/test/plugin/objectSupport.test.js
index 06b10f9..abf046d 100755
--- a/test/plugin/objectSupport.test.js
+++ b/test/plugin/objectSupport.test.js
@@ -140,6 +140,12 @@ it('Constructor from Object UTC', () => {
     expect(moment.utc(tests[i][0]).format(fmt)).toBe(result)
   }
 })
+
+it('Constructor from null should return Invalid Date', () => {
+  expect(dayjs(null).isValid()).toBe(false)
+  expect(moment(null).isValid()).toBe(false)
+})
+
 it('Set from Object', () => {
   for (let i = 0; i < tests.length; i += 1) {
     expect(dayjs(now).set(tests[i][0]).format(fmt)).toBe(moment(now).set(tests[i][0]).format(fmt))
@@ -384,3 +390,11 @@ it('add decimal values of days and months', () => {
   expect(dayjs([2016, 7, 1]).add(1.6, 'years').format('YYYY-MM-DD')).toBe('2017-07-01')
   expect(dayjs([2016, 1, 1]).add(1.1, 'quarters').format('YYYY-MM-DD')).toBe('2016-04-01')
 })
+
+it('returns valid date on undefined', () => {
+  expect(dayjs().isValid()).toBe(true)
+})
+
+it('returns invalid date on null', () => {
+  expect(dayjs(null).isValid()).toBe(false)
+})