From 11e92027cff5548c5a126f690e5a8ed3cd971f89 Mon Sep 17 00:00:00 2001 From: titanism <101466223+titanism@users.noreply.github.com> Date: Sun, 18 Jun 2023 11:55:14 -0500 Subject: [PATCH] fix: objectSupport plugin causes an error when null is passed to dayjs function (closes #2277) This is a fix per #2277, discovered through usage with `twilio` npm package which has this same conflict. --- src/plugin/objectSupport/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugin/objectSupport/index.js b/src/plugin/objectSupport/index.js index 650166606..939c97952 100644 --- a/src/plugin/objectSupport/index.js +++ b/src/plugin/objectSupport/index.js @@ -1,7 +1,7 @@ export default (o, c, dayjs) => { const proto = c.prototype const isObject = obj => !(obj instanceof Date) && !(obj instanceof Array) - && !proto.$utils().u(obj) && (obj.constructor.name === 'Object') + && !proto.$utils().u(obj) && obj !== null && (obj.constructor.name === 'Object'); const prettyUnit = (u) => { const unit = proto.$utils().p(u) return unit === 'date' ? 'day' : unit