diff --git a/frontend/src/component/application/application-edit-component.js b/frontend/src/component/application/application-edit-component.js index 6806a27e39..9d737435cc 100644 --- a/frontend/src/component/application/application-edit-component.js +++ b/frontend/src/component/application/application-edit-component.js @@ -21,7 +21,7 @@ import { Switch, } from 'react-mdl'; import { IconLink, shorten, styles as commonStyles } from '../common'; -import { formatFullDateTime } from '../common/util'; +import { formatFullDateTimeWithLocale } from '../common/util'; class StatefulTextfield extends Component { static propTypes = { @@ -59,6 +59,7 @@ class ClientApplications extends PureComponent { fetchApplication: PropTypes.func.isRequired, appName: PropTypes.string, application: PropTypes.object, + location: PropTypes.object, storeApplicationMetaData: PropTypes.func.isRequired, }; @@ -70,7 +71,9 @@ class ClientApplications extends PureComponent { componentDidMount() { this.props.fetchApplication(this.props.appName); } - + formatFullDateTime(v) { + return formatFullDateTimeWithLocale(v, this.props.location.locale); + } render() { if (!this.props.application) { return ; @@ -142,7 +145,7 @@ class ClientApplications extends PureComponent { icon="timeline" subtitle={ - {clientIp} last seen at {formatFullDateTime(lastSeen)} + {clientIp} last seen at {this.formatFullDateTime(lastSeen)} } > diff --git a/frontend/src/component/application/application-edit-container.js b/frontend/src/component/application/application-edit-container.js index b3b2d66989..82d9ebde37 100644 --- a/frontend/src/component/application/application-edit-container.js +++ b/frontend/src/component/application/application-edit-container.js @@ -4,11 +4,13 @@ import { fetchApplication, storeApplicationMetaData } from '../../store/applicat const mapStateToProps = (state, props) => { let application = state.applications.getIn(['apps', props.appName]); + const location = state.settings.toJS().location || {}; if (application) { application = application.toJS(); } return { application, + location, }; }; diff --git a/frontend/src/component/common/util.js b/frontend/src/component/common/util.js index 500fab2419..325887c01a 100644 --- a/frontend/src/component/common/util.js +++ b/frontend/src/component/common/util.js @@ -26,5 +26,3 @@ export const formatFullDateTimeWithLocale = (v, locale) => { dateTimeOptions.timeZone = found ? found.timezone : 'UTC'; return new Date(v).toLocaleString(locale, dateTimeOptions); }; - -export const formatFullDateTime = v => formatFullDateTimeWithLocale(v, 'nb-NO'); diff --git a/frontend/src/component/feature/metric-component.jsx b/frontend/src/component/feature/metric-component.jsx index 1e1efb344c..33bd4fa947 100644 --- a/frontend/src/component/feature/metric-component.jsx +++ b/frontend/src/component/feature/metric-component.jsx @@ -45,7 +45,7 @@ export default class MetricComponent extends React.Component { this.props.fetchSeenApps(); this.props.fetchFeatureMetrics(); } - formatFulldateTime(v) { + formatFullDateTime(v) { return formatFullDateTimeWithLocale(v, this.props.location.locale); } render() { @@ -110,7 +110,7 @@ export default class MetricComponent extends React.Component { )} - Created {this.formatFulldateTime(featureToggle.createdAt)} + Created {this.formatFullDateTime(featureToggle.createdAt)}