dmtrKovalenko / date-io

Abstraction over common javascript date management libraries
MIT License
726 stars 90 forks source link

Cannot read properties of undefined (reading 'replace') with DayJS #602

Closed yanickrochon closed 2 years ago

yanickrochon commented 2 years ago

I am receiving the error Cannot read properties of undefined (reading 'replace').

Upon investigating, I find that this line declares fullDate as "ll"

https://github.com/dmtrKovalenko/date-io/blob/e70582f726e4612ba08acb4083112803f790994f/packages/dayjs/src/dayjs-utils.ts#L47

Whereas DayJS declares no such format, but "LL" (see here)

This results in this line failing because there is no such format available

https://github.com/dmtrKovalenko/date-io/blob/e70582f726e4612ba08acb4083112803f790994f/packages/dayjs/src/dayjs-utils.ts#L177

Where the above line has these arguments :

dmtrKovalenko commented 2 years ago

We have test suite that covers all the formats, and here is a fullDate working. Feel free to reopen if you have more questions https://github.com/dmtrKovalenko/date-io/blob/c694d02d849d2d9f98f337b99abf7398a006856d/__tests__/formats.test.ts#L67

yanickrochon commented 2 years ago

The point is that this lib decalres an alias of fullDate to be ll, whereas DayJS defines no such format, but LL.

dmtrKovalenko commented 2 years ago

@yanickrochon it has this format with plugin we are including by default https://day.js.org/docs/en/display/format#localized-formats