Set the locale based on the settings.

Partially fixes #4
master
Tom Hacohen 6 years ago
parent 43044750e3
commit 3b7fadcc69

@ -3,6 +3,9 @@ import { connect } from 'react-redux';
import { Action } from 'redux-actions';
import { Route, Switch, Redirect, RouteComponentProps, withRouter } from 'react-router';
import * as moment from 'moment';
import 'moment/locale/en-gb';
import { List, Map } from 'immutable';
import { createSelector } from 'reselect';
@ -19,7 +22,7 @@ import Pim from './Pim';
import * as EteSync from './api/EteSync';
import { CURRENT_VERSION } from './api/Constants';
import { store, JournalsType, EntriesType, StoreState, CredentialsData, UserInfoType } from './store';
import { store, SettingsType, JournalsType, EntriesType, StoreState, CredentialsData, UserInfoType } from './store';
import { addJournal, fetchAll, fetchEntries, fetchUserInfo, createUserInfo } from './store/actions';
export interface SyncInfoJournal {
@ -36,6 +39,7 @@ interface PropsType {
}
type PropsTypeInner = RouteComponentProps<{}> & PropsType & {
settings: SettingsType;
journals: JournalsType;
entries: EntriesType;
userInfo: UserInfoType;
@ -181,6 +185,10 @@ class SyncGate extends React.PureComponent<PropsTypeInner> {
return (<LoadingIndicator style={{display: 'block', margin: '40px auto'}} />);
}
// FIXME: Shouldn't be here
moment.locale(this.props.settings.locale);
const journalMap = syncInfoSelector(this.props);
return (
@ -235,6 +243,7 @@ class SyncGate extends React.PureComponent<PropsTypeInner> {
const mapStateToProps = (state: StoreState, props: PropsType) => {
return {
settings: state.settings,
journals: state.cache.journals,
entries: state.cache.entries,
userInfo: state.cache.userInfo,

@ -2,14 +2,12 @@ import * as React from 'react';
import BigCalendar, { View } from 'react-big-calendar';
import 'react-big-calendar/lib/css/react-big-calendar.css';
import * as moment from 'moment';
import 'moment/locale/en-gb';
import * as ICAL from 'ical.js';
import { EventType } from '../pim-types';
import './Calendar.css';
moment.locale('en-gb');
const calendarLocalizer = BigCalendar.momentLocalizer(moment);
const MAX_RECURRENCE_DATE = ICAL.Time.now();

Loading…
Cancel
Save