update date-format matching for formats with am/pm

This commit is contained in:
Nathan Woulfe
2020-06-08 15:15:03 +10:00
committed by Sebastiaan Janssen
parent bafd058aa8
commit b0f26dabc5
2 changed files with 4 additions and 2 deletions

View File

@@ -55,7 +55,9 @@ function dateTimePickerController($scope, angularHelper, dateHelper, validationM
};
// Don't show calendar if date format has been set to only time
if ($scope.model.config.format === "HH:mm:ss" || $scope.model.config.format === "HH:mm" || $scope.model.config.format === "HH") {
const timeFormat = $scope.model.config.format.toLowerCase();
const timeFormatPattern = /^h{1,2}:m{1,2}:s{1,2}\s?a?$/gmi;
if (timeFormat.match(timeFormatPattern)) {
$scope.datePickerConfig.enableTime = true;
$scope.datePickerConfig.noCalendar = true;
}

View File

@@ -25,7 +25,7 @@
<span class="sr-only"><localize key="content_removeDate">Clear date</localize></span>
</button>
<span class="add-on" aria-hidden="true">
<i class="icon-calendar"></i>
<i class="icon-{{ datePickerConfig.noCalendar ? 'time' : 'calendar' }}"></i>
</span>
</div>