Force formatted_time to use device time zone (#1057)
This commit is contained in:
parent
a139f3f870
commit
b2b2b24051
1 changed files with 4 additions and 2 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue