Force formatted_time to use device time zone (#1057)

This commit is contained in:
Chris Duarte 2017-10-24 11:21:15 -07:00 committed by Harrison Healey
parent a139f3f870
commit b2b2b24051

View file

@ -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);