diff --git a/platform/commonUI/general/res/templates/controls/datetime-field.html b/platform/commonUI/general/res/templates/controls/datetime-field.html index 51fbdc636d..fba5898a51 100644 --- a/platform/commonUI/general/res/templates/controls/datetime-field.html +++ b/platform/commonUI/general/res/templates/controls/datetime-field.html @@ -12,8 +12,8 @@
diff --git a/platform/commonUI/general/src/controllers/DateTimeFieldController.js b/platform/commonUI/general/src/controllers/DateTimeFieldController.js index bc932a7563..2084c32382 100644 --- a/platform/commonUI/general/src/controllers/DateTimeFieldController.js +++ b/platform/commonUI/general/src/controllers/DateTimeFieldController.js @@ -55,6 +55,7 @@ define( $scope.textInvalid = false; $scope.lastValidValue = $scope.textValue; } + $scope.pickerModel = { value: value }; } function updateFromView(textValue) { @@ -66,6 +67,14 @@ define( } } + function updateFromPicker(value) { + $scope.ngModel[$scope.field] = value; + updateFromModel(value); + if ($scope.structure && $scope.structure.submit) { + $scope.structure.submit(); + } + } + function setFormat(format) { formatter = formatService.getFormat(format || defaultFormat); updateFromModel($scope.ngModel[$scope.field]); @@ -82,6 +91,7 @@ define( $scope.$watch('structure.format', setFormat); $scope.$watch('ngModel[field]', updateFromModel); + $scope.$watch('pickerModel.value', updateFromPicker); $scope.$watch('textValue', updateFromView); }