From df4dd6a78464b49405bd98728406d3001dd96b1d Mon Sep 17 00:00:00 2001 From: Corinne Krych Date: Thu, 8 Feb 2018 12:57:36 +0100 Subject: [PATCH] fix(locale): make timezone defaulted --- frontend/public/unknown-locale.png | Bin 0 -> 15691 bytes .../{unkown-user.png => unknown-user.png} | Bin .../application/application-edit-component.js | 3 +- .../component/common/__tests__/util-test.jsx | 18 +++++++---- frontend/src/component/common/util.js | 22 +++---------- .../component/user/show-user-component.jsx | 29 +++++++++++++----- 6 files changed, 40 insertions(+), 32 deletions(-) create mode 100644 frontend/public/unknown-locale.png rename frontend/public/{unkown-user.png => unknown-user.png} (100%) diff --git a/frontend/public/unknown-locale.png b/frontend/public/unknown-locale.png new file mode 100644 index 0000000000000000000000000000000000000000..00b618ad5a36c13d3c9534b096ed525c2869b13e GIT binary patch literal 15691 zcmb`ubySt#+Ad7WBBdLF1&VZccY}0yNq2XrfFK}^2!gO^>69)3K|&>@k?xK&`R)C_ z=j`u$$2k8S##n=AJ!|GY=e*;(uNnJFMHUl{6b%jz4pUxEN*xXkp6T%ec>><}1}1uf zfAH?=vJ!BWW8{Cq7gQHHJ$E=bbiBt8JX}@|F&rGilC7q$hpw`cfQ7RoiMFmYl5}>nqT*)Z zVqt@dpixm#3AtHX3#d!U{JT2%CJcS;;o%~{%IfXy&En0;;_PO_%FfTv&&tNZ%E7@5 zN-(?oI(eA+Fgv-^{Hu}wYDdb--NMb*#lzOwiR!UkGjnH84`C?uv7`U~``0)vE&jV7 z7f&~be|oXBV6}3va

taA##_VQ2lH>Vet*cSR@ne@g?%h1JK*1yo}DA1is-TL159 z{YS0GU;b6?A8Gt+kV2Lg0&cc8uRYxVkC))5e`F=@;PIbt|LX?_+eaA+IG8!v2t$3C zEv>B0JRLlsB9fA9RIfbE9c(SAq?{eiY@Mj2tSoIU%>I$mzeR1~W(B@`S%HZ-I)ec| z%G~9jI+p)bVfC|ebN*+XLadL1b+G-;JdJ|6V_V*nzjyyG|F1FqA6w#|A^+|-0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)p?8bvHm6Ja0Uy_EF|1JI6<3{q`?@C|QRThYbgYaJ*Dw1m_yQ6;Gv@HRM% zGsWZNjTSdH__S1b8@&aI-0#K{6kc=UMbiZ7RCO3ZAS7H3Z8sTn>od*F0BAA0@K23{-((a_~jH9xj0L3J!{D$J;DOHE636kgh-`cmWZa?Pep-=;}Yj@i7% z%iO}x11RnGeAFUBj8QWk#)e~`UYYk*^1FK0zUoVv5eE9!E<_CZmq&`~3mK>PdpT3a zt^%}q@5L_OPuv_0Mtm(d*Cj*L){Y+U=i7@TYFL1@P=ka10;e?jJG`Em(Xx%Fg3^iI zW|n!R(-J-7g=QkG`iorh{_;EG7A1WG1`icQibtJ90}PO-e4@c0;{MvWxQdxqTrxY# zPnJj`I%)57aKrH^F#dJ#>Rnuj`x9~mJ>^h?m1YyxER~^!miI4RNif3ORAM)$+~{v0 z!QT@+G=P5kBuh0!P$I+9%pj{x+3!v{&VZ&q6d}#PKiNImEo*Pyb{bFY@OZ&D9FYDX@WF$-U4PIFiKrO)EFCedj-*SN3g4reV3N=pkoJVC#jaZTFh6zq6>1)+f}Un3}!39zWVfxGwQGqi>Gp0FfX5= z=P&ygCy|+!QI1||p?I<++($Er4iBT1i%TXa)yD}o`S%UEt1$o5$;T^lxMseI{QbSt zp{^`KE2^WBd(G+CgCojf#^N+eQUm}#Y?7Mh;} zT@=%*Q=0k_uDV)HqAC= - {clientIp} last seen at {this.formatFullDateTime(lastSeen)} + {clientIp} last seen at{' '} + {this.formatFullDateTime(lastSeen)} } > diff --git a/frontend/src/component/common/__tests__/util-test.jsx b/frontend/src/component/common/__tests__/util-test.jsx index 5392876a07..cb86e4fdf8 100644 --- a/frontend/src/component/common/__tests__/util-test.jsx +++ b/frontend/src/component/common/__tests__/util-test.jsx @@ -1,11 +1,17 @@ import { formatFullDateTimeWithLocale } from '../util'; test('formats dates correctly', () => { - expect(formatFullDateTimeWithLocale(1487861809466, 'nb-NO')).toEqual('2017-02-23 14:56:49'); - expect(formatFullDateTimeWithLocale(1487232809466, 'nb-NO')).toEqual('2017-02-16 08:13:29'); - expect(formatFullDateTimeWithLocale(1477232809466, 'nb-NO')).toEqual('2016-10-23 14:26:49'); + expect(formatFullDateTimeWithLocale(1487861809466, 'nb-NO', 'UTC')).toEqual('2017-02-23 14:56:49'); + expect(formatFullDateTimeWithLocale(1487861809466, 'nb-NO', 'Europe/Paris')).toEqual('2017-02-23 15:56:49'); + expect(formatFullDateTimeWithLocale(1487861809466, 'nb-NO', 'Europe/Oslo')).toEqual('2017-02-23 15:56:49'); + expect(formatFullDateTimeWithLocale(1487861809466, 'nb-NO', 'Europe/London')).toEqual('2017-02-23 14:56:49'); + expect(formatFullDateTimeWithLocale(1487861809466, 'en-GB', 'Europe/Paris')).toEqual('02/23/2017, 3:56:49 PM'); + expect(formatFullDateTimeWithLocale(1487861809466, 'en-GB', 'Europe/Oslo')).toEqual('02/23/2017, 3:56:49 PM'); + expect(formatFullDateTimeWithLocale(1487861809466, 'en-GB', 'Europe/London')).toEqual('02/23/2017, 2:56:49 PM'); - expect(formatFullDateTimeWithLocale(1487861809466, 'us-US')).toEqual('2017-02-23 09:56:49'); - expect(formatFullDateTimeWithLocale(1487232809466, 'us-US')).toEqual('2017-02-16 03:13:29'); - expect(formatFullDateTimeWithLocale(1477232809466, 'us-US')).toEqual('2016-10-23 10:26:49'); + expect(formatFullDateTimeWithLocale(1487861809466, 'nb-NO')).toEqual( + expect.stringMatching(/(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})/) + ); + expect(formatFullDateTimeWithLocale(1487861809466, 'en-GB')).toEqual(expect.stringContaining('02/23/2017')); + expect(formatFullDateTimeWithLocale(1487861809466, 'en-US')).toEqual(expect.stringContaining('02/23/2017')); }); diff --git a/frontend/src/component/common/util.js b/frontend/src/component/common/util.js index 325887c01a..0439f99dfb 100644 --- a/frontend/src/component/common/util.js +++ b/frontend/src/component/common/util.js @@ -6,23 +6,9 @@ const dateTimeOptions = { minute: '2-digit', second: '2-digit', }; -// todo for a more comprehensive list use of moment.tz from https://github.com/moment/moment-timezone -const predefinedLocale = [ - { - locale: 'nb-NO', - timezone: 'UTC', - }, - { - locale: 'us-US', - timezone: 'America/New_York', - }, - { - locale: 'en-GB', - timezone: 'Europe/London', - }, -]; -export const formatFullDateTimeWithLocale = (v, locale) => { - let found = predefinedLocale.find(v => v.locale === locale); - dateTimeOptions.timeZone = found ? found.timezone : 'UTC'; +export const formatFullDateTimeWithLocale = (v, locale, tz) => { + if (tz) { + dateTimeOptions.timeZone = tz; + } return new Date(v).toLocaleString(locale, dateTimeOptions); }; diff --git a/frontend/src/component/user/show-user-component.jsx b/frontend/src/component/user/show-user-component.jsx index eb1c056fab..4375f6bb5c 100644 --- a/frontend/src/component/user/show-user-component.jsx +++ b/frontend/src/component/user/show-user-component.jsx @@ -9,24 +9,39 @@ export default class ShowUserComponent extends React.Component { fetchUser: PropTypes.func.isRequired, updateSettingLocation: PropTypes.func.isRequired, }; - possibleLocales = ['nb-NO', 'us-US', 'en-GB']; + possibleLocales = [ + { value: 'nb-NO', image: 'nb-NO' }, + { value: 'us-US', image: 'us-US' }, + { value: 'en-GB', image: 'en-GB' }, + ]; componentDidMount() { this.props.fetchUser(); + // find default locale and add it in choices if not present + let locale = navigator.language; + let found = this.possibleLocales.find(l => l.value === locale); + if (!found) { + this.possibleLocales.push({ value: locale, image: 'unknown-locale' }); + } } updateLocale() { - const locale = this.props.location ? this.props.location.locale : this.possibleLocales[0]; - let index = this.possibleLocales.findIndex(v => v === locale); + const locale = this.props.location + ? this.props.location.locale + : this.possibleLocales[this.possibleLocales.length - 1]; + let index = this.possibleLocales.findIndex(v => v.value === locale); index = (index + 1) % this.possibleLocales.length; - this.props.updateSettingLocation('locale', this.possibleLocales[index]); + this.props.updateSettingLocation('locale', this.possibleLocales[index].value); } render() { const email = this.props.profile ? this.props.profile.email : ''; - const locale = this.props.location ? this.props.location.locale : this.possibleLocales[0]; - const imageUrl = email ? this.props.profile.imageUrl : 'public/unkown-user.png'; - const imageLocale = `public/${locale}.png`; + const locale = this.props.location + ? this.props.location.locale + : this.possibleLocales[this.possibleLocales.length - 1].value; + let foundLocale = this.possibleLocales.find(l => l.value === locale); + const imageUrl = email ? this.props.profile.imageUrl : 'public/unknown-user.png'; + const imageLocale = foundLocale ? `public/${foundLocale.image}.png` : `public/unknown-locale.png`; return (