From 2f44298758e3b33393170657c5d10d8594295925 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Fri, 22 Jul 2016 12:11:34 -0500 Subject: [PATCH 1/2] [moment] Deprecation warning fix, use updateLocale --- src/ui/public/timepicker/kbn_global_timepicker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/public/timepicker/kbn_global_timepicker.js b/src/ui/public/timepicker/kbn_global_timepicker.js index 2e730897d5ec2..fe1e746db3678 100644 --- a/src/ui/public/timepicker/kbn_global_timepicker.js +++ b/src/ui/public/timepicker/kbn_global_timepicker.js @@ -22,7 +22,7 @@ UiModules config.bindToScope($scope, 'dateFormat:dow', 'dateFormat_dow'); $scope.$watch('dateFormat_dow', function (day) { const dow = moment.weekdays().indexOf(day); - moment.locale(moment.locale(), { week: { dow } }); + moment.updateLocale(moment.locale(), { week: { dow } }); }); listenForUpdates($rootScope); From d3187d0c6379dcc882b26a09e3b78ebd065992c1 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Fri, 22 Jul 2016 12:28:36 -0500 Subject: [PATCH 2/2] [config] Move day of week next to timezone config --- src/core_plugins/kibana/public/kibana.js | 6 ++++++ src/ui/public/timepicker/kbn_global_timepicker.js | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core_plugins/kibana/public/kibana.js b/src/core_plugins/kibana/public/kibana.js index 222964447c3a6..4465c7c93541d 100644 --- a/src/core_plugins/kibana/public/kibana.js +++ b/src/core_plugins/kibana/public/kibana.js @@ -35,10 +35,16 @@ chrome }); config.watch('dateFormat:tz', setDefaultTimezone, $scope); + config.watch('dateFormat:dow', setStartDayOfWeek, $scope); function setDefaultTimezone(tz) { moment.tz.setDefault(tz); } + + function setStartDayOfWeek(day) { + const dow = moment.weekdays().indexOf(day); + moment.updateLocale(moment.locale(), { week: { dow } }); + } }); modules.get('kibana').run(Notifier.pullMessageFromUrl); diff --git a/src/ui/public/timepicker/kbn_global_timepicker.js b/src/ui/public/timepicker/kbn_global_timepicker.js index fe1e746db3678..b4323d26dbccc 100644 --- a/src/ui/public/timepicker/kbn_global_timepicker.js +++ b/src/ui/public/timepicker/kbn_global_timepicker.js @@ -19,12 +19,6 @@ UiModules return { template: toggleHtml, link: ($scope, $el, attrs) => { - config.bindToScope($scope, 'dateFormat:dow', 'dateFormat_dow'); - $scope.$watch('dateFormat_dow', function (day) { - const dow = moment.weekdays().indexOf(day); - moment.updateLocale(moment.locale(), { week: { dow } }); - }); - listenForUpdates($rootScope); $rootScope.timefilter = timefilter;