motss / app-datepicker

Datepicker element built with Google's lit and Material Design 2021
https://npm.im/app-datepicker
MIT License
178 stars 51 forks source link

Error "Cannot read property 'getUTCFullYear' of null" after nodemod/calendar.js update. #201

Closed andresbeltran69 closed 3 years ago

andresbeltran69 commented 3 years ago

Description

Error "Cannot read property 'getUTCFullYear' of null" after nodemod/calendar.js update. app-datepicker not showing.

Expected outcome

open app-datepicker

Actual outcome

Error "Cannot read property 'getUTCFullYear' of null" and doesn't show the element.

Steps to reproduce

  1. Put a app-datepicker element in the page.
  2. Open the page in a web browser.
  3. Click the app-datepicker element.

Browsers Affected

Possible solution.

After nodemod/calendar.js was updated the calendar options names changed. In this case "selectedDate" changed to "date" on

https://github.com/motss/nodemod/blob/d5f5a4c81ee4defd741ea0fd39a8fa748539ba54/src/calendar/calendar.ts#L28

So in order to get the date from

https://github.com/motss/app-datepicker/blob/cbdaa74f762388176ce98200497dd21b6281ed27/src/helpers/get-multi-calendars.ts#L116

the name of the variables need to match. That worked for me.

motss commented 3 years ago

Thanks for reporting this. This has been fixed in 9d85e7d642cd872ee483dc3fc0e0bf6cbdb27171.