From caa866c816323402bb6ad9b7ddafe59992a208c4 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 16 Sep 2019 19:21:17 +0200 Subject: [PATCH] Client - localize Calendar w/ date-fns - fix #40 --- fittrackee_client/e2e/register.test.js | 6 +++--- .../src/components/Dashboard/Calendar.jsx | 19 +++++++++++++------ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/fittrackee_client/e2e/register.test.js b/fittrackee_client/e2e/register.test.js index f0c051e6..596f4e12 100644 --- a/fittrackee_client/e2e/register.test.js +++ b/fittrackee_client/e2e/register.test.js @@ -95,7 +95,7 @@ test('should throw an error if the username is too short', async t => { await t .expect(Selector('H1').withText('Register').exists).ok() .expect(Selector('code').withText( - 'Username: 3 to 12 characters required.').exists).ok() + '3 to 12 characters required for username.').exists).ok() }) test('should throw an error if the user is too long', async t => { @@ -115,7 +115,7 @@ test('should throw an error if the user is too long', async t => { await t .expect(Selector('H1').withText('Register').exists).ok() .expect(Selector('code').withText( - 'Username: 3 to 12 characters required.').exists).ok() + '3 to 12 characters required for username.').exists).ok() }) test('should throw an error if the email is invalid', async t => { @@ -173,5 +173,5 @@ test('should throw an error if the password is too short', async t => { await t .expect(Selector('H1').withText('Register').exists).ok() .expect(Selector('code').withText( - 'Password: 8 characters required.').exists).ok() + '8 characters required for password.').exists).ok() }) diff --git a/fittrackee_client/src/components/Dashboard/Calendar.jsx b/fittrackee_client/src/components/Dashboard/Calendar.jsx index 0b627dfd..4c8fd164 100644 --- a/fittrackee_client/src/components/Dashboard/Calendar.jsx +++ b/fittrackee_client/src/components/Dashboard/Calendar.jsx @@ -12,6 +12,7 @@ import { startOfWeek, subMonths, } from 'date-fns' +import { enGB, fr } from 'date-fns/locale' import React, { Fragment } from 'react' import { connect } from 'react-redux' import { Link } from 'react-router-dom' @@ -46,7 +47,7 @@ class Calendar extends React.Component { this.props.loadMonthActivities(this.state.startDate, this.state.endDate) } - renderHeader() { + renderHeader(localeOptions) { const dateFormat = 'MMM yyyy' return (
@@ -54,7 +55,9 @@ class Calendar extends React.Component {