diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2018-07-24 10:38:03 -0300 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2018-07-24 13:40:37 -0300 |
| commit | 0dc574dbdfab50c11ae05fd834e1b76448ca95eb (patch) | |
| tree | e61b4355420e603b721f356839ab0d011422bce7 | |
| parent | 7fc6c80ee49d57fc84597d83b0216dd8df6dc127 (diff) | |
| download | mullvadvpn-0dc574dbdfab50c11ae05fd834e1b76448ca95eb.tar.xz mullvadvpn-0dc574dbdfab50c11ae05fd834e1b76448ca95eb.zip | |
Localize expiry time
| -rw-r--r-- | app/components/Account.js | 11 | ||||
| -rw-r--r-- | app/containers/AccountPage.js | 2 | ||||
| -rw-r--r-- | test/components/Account.spec.js | 1 |
3 files changed, 12 insertions, 2 deletions
diff --git a/app/components/Account.js b/app/components/Account.js index 9b6e1c8dea..bcb2c11ebd 100644 --- a/app/components/Account.js +++ b/app/components/Account.js @@ -14,6 +14,7 @@ import type { AccountToken } from '../lib/daemon-rpc'; export type AccountProps = { accountToken: AccountToken, accountExpiry: string, + expiryLocale: string, updateAccountExpiry: () => Promise<void>, onLogout: () => void, onClose: () => void, @@ -76,9 +77,15 @@ export default class Account extends Component<AccountProps, AccountState> { render() { const expiry = moment(this.props.accountExpiry); - const formattedAccountToken = formatAccount(this.props.accountToken || ''); - const formattedExpiry = expiry.format('hA, D MMMM YYYY').toUpperCase(); const isOutOfTime = expiry.isSameOrBefore(moment()); + const formattedAccountToken = formatAccount(this.props.accountToken || ''); + const formattedExpiry = expiry.toDate().toLocaleString(this.props.expiryLocale, { + day: 'numeric', + month: 'long', + year: 'numeric', + hour: 'numeric', + minute: 'numeric', + }); return ( <Layout> diff --git a/app/containers/AccountPage.js b/app/containers/AccountPage.js index 2c23d326d8..a85ad3d43f 100644 --- a/app/containers/AccountPage.js +++ b/app/containers/AccountPage.js @@ -1,5 +1,6 @@ // @flow +import { remote } from 'electron'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import { push } from 'react-router-redux'; @@ -14,6 +15,7 @@ import type { SharedRouteProps } from '../routes'; const mapStateToProps = (state: ReduxState) => ({ accountToken: state.account.accountToken, accountExpiry: state.account.expiry, + expiryLocale: remote.app.getLocale(), }); const mapDispatchToProps = (dispatch: ReduxDispatch, props: SharedRouteProps) => { const { copyAccountToken } = bindActionCreators(accountActions, dispatch); diff --git a/test/components/Account.spec.js b/test/components/Account.spec.js index 9d6e1cdbe8..a850c6af06 100644 --- a/test/components/Account.spec.js +++ b/test/components/Account.spec.js @@ -11,6 +11,7 @@ describe('components/Account', () => { const defaultProps: AccountProps = { accountToken: '1234', accountExpiry: new Date('2038-01-01').toISOString(), + expiryLocale: 'en-US', updateAccountExpiry: () => Promise.resolve(), onCopyAccountToken: () => {}, onClose: () => {}, |
