Commit 098d30d7 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg Committed by Sébastiaan Versteeg
Browse files

Remove setting Moment locale in multiple components

parent 523c9065
......@@ -2,11 +2,12 @@ import React, { Component } from 'react';
import { AsyncStorage, Linking, Platform } from 'react-native';
import { applyMiddleware, combineReducers, createStore } from 'redux';
import { Provider } from 'react-redux';
import { I18nextProvider } from 'react-i18next';
import createSagaMiddleware from 'redux-saga';
import FCM, { FCMEvent } from 'react-native-fcm';
import locale from 'react-native-locale-detector';
import Moment from 'moment';
import 'moment/locale/nl';
import { I18nextProvider } from 'react-i18next';
import * as reducers from './reducers';
......@@ -52,8 +53,16 @@ FCM.on(FCMEvent.RefreshToken, async () => {
});
class Main extends Component {
constructor() {
super();
if (locale.startsWith('nl')) {
Moment.locale(locale);
} else {
Moment.locale('en');
}
}
componentDidMount() {
Moment.locale('nl');
AsyncStorage.multiGet([USERNAMEKEY, TOKENKEY, DISPLAYNAMEKEY, PHOTOKEY])
.then(
(result) => {
......
......@@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
import { Text, View, SectionList, ScrollView, RefreshControl } from 'react-native';
import { connect } from 'react-redux';
import Moment from 'moment';
import 'moment/locale/nl';
import * as calendarActions from '../actions/calendar';
import EventCard from './EventCard';
......@@ -118,10 +117,6 @@ const renderItem = (item) => {
};
class Calendar extends Component {
componentDidMount() {
Moment.locale('nl');
}
handleRefresh = () => {
this.props.refresh();
};
......
......@@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
import { FlatList, Alert, Image, ScrollView, Text, View, RefreshControl, Button, TouchableHighlight, Platform, Linking } from 'react-native';
import { connect } from 'react-redux';
import Moment from 'moment';
import 'moment/locale/nl';
import styles, { memberSize } from './style/event';
import MemberView from './MemberView';
......
......@@ -10,7 +10,6 @@ import * as eventActions from '../actions/event';
import styles from './style/eventCard';
const getEventInfo = (event) => {
Moment.locale('nl');
if (event.start === null && event.end === null) {
return event.location;
} else if (event.start === null) {
......
......@@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
import { View, Text, TouchableOpacity, TouchableHighlight } from 'react-native';
import { connect } from 'react-redux';
import Moment from 'moment';
import 'moment/locale/nl';
import * as actions from '../actions/event';
import { retrievePizzaInfo } from '../actions/pizza';
......@@ -12,7 +11,6 @@ import styles from './style/eventDetailCard';
import { colors } from '../style';
const getInfo = (event) => {
Moment.locale('nl');
const start = Moment(event.start);
const end = Moment(event.end);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment