diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/datepicker/datepicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/datepicker/datepicker.controller.js index 5529400976..5a768f8d91 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/datepicker/datepicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/datepicker/datepicker.controller.js @@ -8,12 +8,21 @@ function dateTimePickerController($scope, notificationsService, assetsService, a pickDate: true, pickTime: true, pick12HourFormat: false, + autoclose: true, format: "yyyy-MM-dd hh:mm:ss" }; //map the user config $scope.model.config = angular.extend(config, $scope.model.config); + //hide picker if clicking on the document + $scope.hidePicker = function () { + $element.find("div:first").datetimepicker("hide"); + }; + $(document).click(function (event) { + $scope.hidePicker(); + }); + //handles the date changing via the api function applyDate(e) { angularHelper.safeApply($scope, function() { @@ -26,8 +35,10 @@ function dateTimePickerController($scope, notificationsService, assetsService, a $scope.model.value = e.localDate.toIsoDateString(); } } - - $element.find("div:first").datetimepicker("hide", 0); + + if (!$scope.model.config.pickTime) { + $element.find("div:first").datetimepicker("hide", 0); + } }); }