mattermost-mobile/app/utils/timezone.js
Elias Nahum 64d22fd0f2 MM-18313 Fix update timezone automatically (#3462)
* MM-18313 Fix update timezone automatically

* add unit tests
2019-10-25 08:01:32 -07:00

19 lines
466 B
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import DeviceInfo from 'react-native-device-info';
import moment from 'moment-timezone';
export function getDeviceTimezoneAsync() {
return DeviceInfo.getTimezoneAsync();
}
export function getDeviceUtcOffset() {
return moment().utcOffset();
}
export function getUtcOffsetForTimeZone(timezone) {
return moment.tz(timezone).utcOffset();
}