I want to translate date to french language using moment library.
I create an android build but it crashed when i open the component.
My code is :
import Moment from 'moment';
// i fixed the error
// var moment = require('moment');
//require('moment/locale/fr');
//moment.locale('fr');
render() {
....
{
this.state.notifications.map((notification, i) => (
Moment.updateLocale('fr', {
// the config here
// translate to french
}),
notification.type === 'Partage de contact' ?
<ListItem
key={i}
...
subtitle={`Date : ${Moment(notification.date).format('dddd D MMMM, YYYY')}`}
bottomDivider
/>
:
<ListItem
...
subtitle={`Date : ${Moment(notification.date).format('dddd D MMMM, YYYY')}`}
bottomDivider
/>
))
}
...
}