Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module not found: TypeCannot read properties of undefined (reading 'startsWith') #487

Open
bigbizze opened this issue Oct 15, 2024 · 1 comment

Comments

@bigbizze
Copy link

bigbizze commented Oct 15, 2024

./node_modules/moment/moment.js
Module not found: TypeCannot read properties of undefined (reading 'startsWith')

Import trace for requested module:
./node_modules/moment/moment.js
./node_modules/moment-timezone/moment-timezone.js
./node_modules/moment-timezone/index.js
./node_modules/date-holidays-parser/src/Equinox.js
./node_modules/date-holidays-parser/src/CalEventFactory.js
./node_modules/date-holidays-parser/src/DateFn.js
./node_modules/date-holidays-parser/src/Holidays.js
./node_modules/date-holidays-parser/src/index.js
./node_modules/date-holidays/src/Holidays.js
./node_modules/date-holidays/src/index.js

I am not sure what is causing this issue, I'm assuming it's some dependency thing between date-holidays, date-holidays-parser, moment-timezone and moment.


I have my resolutions set to:

  "resolutions": {
    "date-holidays-parser": "^3.4.4",
    "moment": "^2.29.4",
    "moment-timezone": "0.5.43"
  },

and i am using [email protected]


date-holidays-parser issue: commenthol/date-holidays-parser#59
moment-timezone issue: moment/moment-timezone#1122
moment issue: moment/moment#6259

@osterreich
Copy link

Faced similar issue when tried to call destructured method returned from Holidays() constructor:

const { isHoliday } = new Holidays('US');
isHoliday(new Date(value));

Error:

Cannot read properties of undefined (reading '__timezone')
TypeError: Cannot read properties of undefined (reading '__timezone')
    at isHoliday (http://localhost:3000/static/js/bundle.js:424791:31)
    ...

Correct usage:

 const holidays = new Holidays('US');
 holidays.isHoliday(new Date(value));

There might be a binding issue somewhere in date-holidays code I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants