From d71ecf1eee1837bba28d8d05dc01194b3c27ef6a Mon Sep 17 00:00:00 2001 From: Marliana Lara Date: Wed, 21 Feb 2018 11:36:19 -0500 Subject: [PATCH] Fix jshint confusing semantics error --- awx/ui/client/src/scheduler/schedulerAdd.controller.js | 9 ++++++--- awx/ui/client/src/scheduler/schedulerEdit.controller.js | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/awx/ui/client/src/scheduler/schedulerAdd.controller.js b/awx/ui/client/src/scheduler/schedulerAdd.controller.js index a32efb4553..661a708dd6 100644 --- a/awx/ui/client/src/scheduler/schedulerAdd.controller.js +++ b/awx/ui/client/src/scheduler/schedulerAdd.controller.js @@ -313,12 +313,15 @@ export default ['$filter', '$state', '$stateParams', '$http', 'Wait', $http.post('/api/v2/schedules/preview/', {'rrule': req}) .then(({data}) => { $scope.preview_list = data; - for (let tz in data) { - $scope.preview_list.isEmpty = data[tz].length === 0; - $scope.preview_list[tz] = data[tz].map(function(date) { + let parsePreviewList = (tz) => { + return data[tz].map(function(date) { date = date.replace(/Z/, ''); return moment.parseZone(date).format("MM-DD-YYYY HH:mm:ss"); }); + }; + for (let tz in data) { + $scope.preview_list.isEmpty = data[tz].length === 0; + $scope.preview_list[tz] = parsePreviewList(tz); } }); }, 300); diff --git a/awx/ui/client/src/scheduler/schedulerEdit.controller.js b/awx/ui/client/src/scheduler/schedulerEdit.controller.js index ff740b61a2..b0d8adcb83 100644 --- a/awx/ui/client/src/scheduler/schedulerEdit.controller.js +++ b/awx/ui/client/src/scheduler/schedulerEdit.controller.js @@ -89,12 +89,15 @@ function($filter, $state, $stateParams, Wait, $scope, moment, $http.post('/api/v2/schedules/preview/', {'rrule': req}) .then(({data}) => { $scope.preview_list = data; - for (let tz in data) { - $scope.preview_list.isEmpty = data[tz].length === 0; - $scope.preview_list[tz] = data[tz].map(function(date) { + let parsePreviewList = (tz) => { + return data[tz].map(function(date) { date = date.replace(/Z/, ''); return moment.parseZone(date).format("MM-DD-YYYY HH:mm:ss"); }); + }; + for (let tz in data) { + $scope.preview_list.isEmpty = data[tz].length === 0; + $scope.preview_list[tz] = parsePreviewList(tz); } }); }, 300);