Swap jstimezonedetect with moment.tz.guess (#21800)

* Swap stimezonedetect with moment.tz.guess

* fix yarn.lock

* fix merge
This commit is contained in:
Jonathan Budzenski 2018-11-19 16:24:25 -06:00 committed by GitHub
parent 6436aff952
commit a3ecbde2de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 6 additions and 16 deletions

View file

@ -145,7 +145,6 @@
"js-yaml": "3.4.1",
"json-stringify-pretty-compact": "1.0.4",
"json-stringify-safe": "5.0.1",
"jstimezonedetect": "1.0.5",
"leaflet": "1.0.3",
"leaflet-draw": "0.4.10",
"leaflet-responsive-popup": "0.2.0",

View file

@ -17,10 +17,9 @@
* under the License.
*/
import { jstz as tzDetect } from 'jstimezonedetect';
import _ from 'lodash';
import chrome from '../../chrome';
import moment from 'moment';
import moment from 'moment-timezone';
import '../../filters/field_type';
import '../../validate_date_interval';
import { BucketAggType } from './_bucket_agg_type';
@ -32,7 +31,7 @@ import { timefilter } from '../../timefilter';
import dropPartialTemplate from '../controls/drop_partials.html';
const config = chrome.getUiSettingsClient();
const detectedTimezone = tzDetect.determine().name();
const detectedTimezone = moment.tz.guess();
const tzOffset = moment().format('Z');
function getInterval(agg) {

View file

@ -17,14 +17,13 @@
* under the License.
*/
const tzDetect = require('jstimezonedetect').jstz;
import moment from 'moment';
import moment from 'moment-timezone';
export function timezoneProvider(config) {
return function () {
if (config.isDefault('dateFormat:tz')) {
const detectedTimezone = tzDetect.determine().name();
const detectedTimezone = moment.tz.guess();
if (detectedTimezone) return detectedTimezone;
else return moment().format('Z');
} else {

View file

@ -184,7 +184,6 @@
"joi": "^13.5.2",
"jquery": "^3.3.1",
"jsonwebtoken": "^8.3.0",
"jstimezonedetect": "1.0.5",
"lodash": "npm:@elastic/lodash@3.10.1-kibana1",
"lodash.clone": "^4.5.0",
"lodash.keyby": "^4.6.0",

View file

@ -4,8 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { jstz as tzDetect } from 'jstimezonedetect';
import moment from 'moment';
import moment from 'moment-timezone';
export class XpackWatcherTimezoneService {
constructor(config) {
@ -19,7 +18,7 @@ export class XpackWatcherTimezoneService {
return this.config.get(DATE_FORMAT_CONFIG_KEY);
}
const detectedTimezone = tzDetect.determine().name();
const detectedTimezone = moment.tz.guess();
if (detectedTimezone) {
return detectedTimezone;
}

View file

@ -12718,11 +12718,6 @@ jsprim@^1.2.2:
json-schema "0.2.3"
verror "1.10.0"
jstimezonedetect@1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/jstimezonedetect/-/jstimezonedetect-1.0.5.tgz#93d035cd20e8c7d64eb1375cf5aa7a10a024466a"
integrity sha1-k9A1zSDox9ZOsTdc9ap6EKAkRmo=
jstransformer-ejs@^0.0.3:
version "0.0.3"
resolved "https://registry.yarnpkg.com/jstransformer-ejs/-/jstransformer-ejs-0.0.3.tgz#04d9201469274fcf260f1e7efd732d487fa234b6"