Apply pickDate-config setting to hide calendar in datepicker (#11632)
* Apply pickDate-config setting to hide calendar in datepicker A time-only picker is only possible if the format is configured like "hh:mm:ss". By using the pickDate config it is possible to determine whether the calendar should be shown or not, instead of depending on a certain time format. * Changed timeformat to accept both hh:mm:ss and hh:mm Edited the regex to math times with and without seconds. The calendar should not be shown anymore if the timeformat is (H)H:mm:ss or (H)H:mm. * Removed unused config property pickDate config.pickDate is never used and can be removed. * remove pickDate config from datepickers config
This commit is contained in:
@@ -124,7 +124,6 @@
|
||||
vm.logOptions.orderDirection = 'Descending';
|
||||
|
||||
vm.fromDatePickerConfig = {
|
||||
pickDate: true,
|
||||
pickTime: true,
|
||||
useSeconds: false,
|
||||
useCurrent: false,
|
||||
@@ -138,7 +137,6 @@
|
||||
};
|
||||
|
||||
vm.toDatePickerConfig = {
|
||||
pickDate: true,
|
||||
pickTime: true,
|
||||
useSeconds: false,
|
||||
format: "YYYY-MM-DD HH:mm",
|
||||
|
||||
@@ -11,7 +11,6 @@ function dateTimePickerController($scope, angularHelper, dateHelper, validationM
|
||||
|
||||
// setup the default config
|
||||
var config = {
|
||||
pickDate: true,
|
||||
pickTime: true,
|
||||
useSeconds: true,
|
||||
format: "YYYY-MM-DD HH:mm:ss",
|
||||
@@ -56,7 +55,7 @@ function dateTimePickerController($scope, angularHelper, dateHelper, validationM
|
||||
|
||||
// Don't show calendar if date format has been set to only time
|
||||
const timeFormat = $scope.model.config.format.toLowerCase();
|
||||
const timeFormatPattern = /^h{1,2}:m{1,2}:s{1,2}\s?a?$/gmi;
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user