Skip to content

dayjs constructor returns "Invalid Date" in the Browser, but valid date in Node.js #2954

@reyronald

Description

@reyronald

Describe the bug

In Chrome:

dayjs('11/1/2004', 'MM/DD/YYYY')
// ^ Invalid Date

In Node.js

dayjs('11/1/2004', 'MM/DD/YYYY')
// ^ 2004-11-01T04:00:00.000Z

Expected behavior

The behavior should be the same in both environments

Information

  • Day.js Version 1.11.3
  • OS: macOS 15.6.1 (Sequoia)
  • Browser: Chrome 142.0.7444.60
  • Node: v22.19.0
  • Time zone: GMT-04:00 DST

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions