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

Using locale yields an error #41

Open
amergin opened this issue Oct 2, 2017 · 2 comments
Open

Using locale yields an error #41

amergin opened this issue Oct 2, 2017 · 2 comments

Comments

@amergin
Copy link

amergin commented Oct 2, 2017

Example:

import React from 'react'
import Moment from 'react-moment';
import 'moment/locale/fi';

export default class MyHeader extends React.Component {
  render() {
    const dateToFormat = '1976-04-19T12:59-0500';
    return (<div>
         <Moment locale="fi">{dateToFormat}</Moment>
      </div>);
  }
}

Yields an error:

ncaught TypeError: Cannot read property 'preparse' of null
    at prepareConfig (from-anything.js?ede6:43)
    at createFromConfig (from-anything.js?ede6:22)
    at createLocalOrUTC (from-anything.js?ede6:109)
    at createLocal (local.js?8ec1:4)
    at hooks (hooks.js?38d9:6)
    at Function.value (index.js?948d:1)
    at t.value (index.js?948d:1)
    at t.value (index.js?948d:1)
    at eval (ReactCompositeComponent.js:347)
    at measureLifeCyclePerf (ReactCompositeComponent.js:75)

No errors if I leave out the locale.

For the webpack config I'm using this definition to avoid the error

Module not found: Error: Can't resolve './locale'
@Enase
Copy link

Enase commented Oct 30, 2019

Did you find any workaround?

@fukemy
Copy link

fukemy commented Jun 28, 2022

same problem here

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