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

TypeError: Cannot read property 'split' of undefined #57

Open
henrycity opened this issue Sep 8, 2017 · 4 comments
Open

TypeError: Cannot read property 'split' of undefined #57

henrycity opened this issue Sep 8, 2017 · 4 comments

Comments

@henrycity
Copy link

I just import TimePicker after importing moment like this.

import moment from 'moment'; 
import TimePicker from 'react-times'

And it shows this error.

moment-timezone.js:37 Uncaught (in promise) TypeError: Cannot read property 'split' of undefined
    at Object.eval (moment-timezone.js:37)

In moment-timezone, the error is in the following line momentVersion = moment.version.split('.'),

Does anyone have any idea what did I do wrong? Thanks.

@ecmadao
Copy link
Owner

ecmadao commented Sep 9, 2017

@tvtri96
Hi tvtri96, thanks for your feedback!
But I have never seen this error before, and it seems like a problem of moment & moment-timezone themselves, and this issus: moment/moment-timezone#449 may be helpful for you.

@henrycity
Copy link
Author

There is no solution to that issue in their repo. How did you make it work in your demo? I cannot see any demo as you use react-storybook.

@henrycity
Copy link
Author

moment/moment-timezone#476
This one seems to solve it.

@capaj
Copy link
Contributor

capaj commented Jun 12, 2018

I've set up a minimal webpack config with just babel loader and style loader and it works without any issue. IMHO just setup your webpack to transpile node_modules. There are plenty of other react modules which have similar issue when they are not transpiled.

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

3 participants