react-moment
react-moment copied to clipboard
Using locale yields an error
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'
Did you find any workaround?
same problem here