mattermost-mobile/app/utils/timezone.js
Mattermost Build 89e85abc62 Automated cherry pick of #3462 (#3473)
* MM-18313 Fix update timezone automatically

* add unit tests
2019-10-25 08:06:14 -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();
}