Skip to content

Non-locale based date strings break when using newer versions of dayjs #51

@csaphiro

Description

@csaphiro

I'm using:

  • material-dayjs-adapter: 2.0.0
  • dayjs 1.10.5
  • angular & angular material 12.1.1

When using a custom date format the datepicker does not recognize the user typing in a date due to an error:

ERROR TypeError: Cannot read properties of undefined (reading 'replace')
at :4200/vendor.js:95004
    at a (:4200/vendor.js:95004)
    at Object.longDateFormat (:4200/vendor.js:95004)
    at DayjsDateAdapter.parse (:4200/main.js:130)
    at MatDatepickerInput._onInput (:4200/vendor.js:87072)
    at MatDatepickerInput_input_HostBindingHandler (:4200/vendor.js:87130)
    at executeListenerWithErrorHandling (:4200/vendor.js:48548)
    at wrapListenerIn_markDirtyAndPreventDefault (:4200/vendor.js:48597)
    at HTMLInputElement.<anonymous> (:4200/vendor.js:92678)
    at ZoneDelegate.invokeTask (:4200/polyfills.js:412)

This appears to be due to a change in dayjs longDateFormat in a recent version

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