Skip to content

Commit 89bf31c

Browse files
authored
fix: objectSupport plugin causes an error when null is passed to dayjs function (closes #2277) (#2342)
1 parent b3624de commit 89bf31c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/plugin/objectSupport/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export default (o, c, dayjs) => {
22
const proto = c.prototype
33
const isObject = obj => !(obj instanceof Date) && !(obj instanceof Array)
4-
&& !proto.$utils().u(obj) && (obj.constructor.name === 'Object')
4+
&& !proto.$utils().u(obj) && obj !== null && (obj.constructor.name === 'Object')
55
const prettyUnit = (u) => {
66
const unit = proto.$utils().p(u)
77
return unit === 'date' ? 'day' : unit

0 commit comments

Comments
 (0)