1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-30 19:52:20 +01:00

(bug) window end time < window start time

This commit is contained in:
Du Peng 2023-04-21 19:28:33 +02:00
parent 112df59c96
commit 57683125a8

View File

@ -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;
}
}
});