Skip to content

objectSupport plugin causes an error when null is passed to dayjs function #2277

Closed
@OverWeo

Description

@OverWeo

Describe the bug
There is an bug, which causes an error Cannot read properties of null (reading 'constructor') when null is passed to dayjs function while objectSupport plugin is enabled e.g. dayjs(null)

Expected behavior
dayjs function should execute and create date object with Invalid Date.

Information
Day.js Version 1.11.7
OS: Ubuntu Linux
Browser - chrome

Fix

&& !proto.$utils().u(obj) && (obj.constructor.name === 'Object')

Change this line to && !proto.$utils().u(obj) && obj !== null && (obj.constructor.name === 'Object');

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions