update date-format matching for formats with am/pm
This commit is contained in:
committed by
Sebastiaan Janssen
parent
bafd058aa8
commit
b0f26dabc5
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user