From b2b2b2405155466eab5c8e45f67bf261a495b4d2 Mon Sep 17 00:00:00 2001 From: Chris Duarte Date: Tue, 24 Oct 2017 11:21:15 -0700 Subject: [PATCH] Force formatted_time to use device time zone (#1057) --- app/components/formatted_time.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/components/formatted_time.js b/app/components/formatted_time.js index 664241e96..f9d1d2726 100644 --- a/app/components/formatted_time.js +++ b/app/components/formatted_time.js @@ -5,6 +5,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import {injectIntl, intlShape} from 'react-intl'; import {Text} from 'react-native'; +import deviceInfo from 'react-native-device-info'; class FormattedTime extends React.PureComponent { static propTypes = { @@ -24,7 +25,9 @@ class FormattedTime extends React.PureComponent { Reflect.deleteProperty(props, 'format'); - const formattedTime = intl.formatTime(value, this.props); + const timeZone = deviceInfo.getTimezone(); + + const formattedTime = intl.formatDate(value, {...props, timeZone, hour: 'numeric', minute: 'numeric'}); if (typeof children === 'function') { return children(formattedTime); @@ -35,4 +38,3 @@ class FormattedTime extends React.PureComponent { } export default injectIntl(FormattedTime); -