From 57683125a89693f4fc1ccb4689881c100a3424be Mon Sep 17 00:00:00 2001 From: Du Peng Date: Fri, 21 Apr 2023 19:28:33 +0200 Subject: [PATCH] (bug) window end time < window start time --- app/frontend/src/javascript/controllers/admin/settings.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/frontend/src/javascript/controllers/admin/settings.js b/app/frontend/src/javascript/controllers/admin/settings.js index 4e07dcc30..e43bca1dc 100644 --- a/app/frontend/src/javascript/controllers/admin/settings.js +++ b/app/frontend/src/javascript/controllers/admin/settings.js @@ -487,8 +487,12 @@ Application.Controllers.controller('SettingsController', ['$scope', '$rootScope' // we prevent the admin from setting the closing time before the opening time $scope.$watch('windowEnd.value', function (newValue, oldValue, scope) { - if ($scope.windowStart && moment($scope.windowStart.value).isAfter(newValue)) { - return $scope.windowEnd.value = oldValue; + if (scope.windowStart) { + const startTime = moment($scope.windowStart.value).format('HH:mm:ss'); + const endTime = moment(newValue).format('HH:mm:ss'); + if (startTime >= endTime) { + scope.windowEnd.value = oldValue; + } } });