diff --git a/package.json b/package.json index bb04bc804fcc8..b0555fad091e1 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/ui/public/agg_types/buckets/date_histogram.js b/src/ui/public/agg_types/buckets/date_histogram.js index 78c926e9cdfcf..d430c87bdd2fd 100644 --- a/src/ui/public/agg_types/buckets/date_histogram.js +++ b/src/ui/public/agg_types/buckets/date_histogram.js @@ -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) { diff --git a/src/ui/public/vis/lib/timezone.js b/src/ui/public/vis/lib/timezone.js index 473be70aa791d..670e47da849e8 100644 --- a/src/ui/public/vis/lib/timezone.js +++ b/src/ui/public/vis/lib/timezone.js @@ -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 { diff --git a/x-pack/package.json b/x-pack/package.json index 249cc08c8b900..3225877113042 100644 --- a/x-pack/package.json +++ b/x-pack/package.json @@ -183,7 +183,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", diff --git a/x-pack/plugins/watcher/public/services/timezone/xpack_watcher_timezone_service.js b/x-pack/plugins/watcher/public/services/timezone/xpack_watcher_timezone_service.js index 8f57c83082147..7f93427fdcc69 100644 --- a/x-pack/plugins/watcher/public/services/timezone/xpack_watcher_timezone_service.js +++ b/x-pack/plugins/watcher/public/services/timezone/xpack_watcher_timezone_service.js @@ -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; } diff --git a/yarn.lock b/yarn.lock index 7aa4417df69e4..22af1acf24fc8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12713,11 +12713,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"