From 1686e2f4bf88d4e769a1e39258dae9269c132170 Mon Sep 17 00:00:00 2001 From: Shannon Date: Fri, 15 Aug 2014 13:48:07 -0600 Subject: [PATCH] Fixes: U4-5333 Datepicker starts on today's date instead of current value when you switch nodes --- .../propertyeditors/datepicker/datepicker.controller.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 d426e58606..885ca43bb5 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 @@ -47,13 +47,16 @@ function dateTimePickerController($scope, notificationsService, assetsService, a // Get the id of the datepicker button that was clicked var pickerId = $scope.model.alias; + // Open the datepicker and add a changeDate eventlistener $element.find("div:first") .datetimepicker($scope.model.config) .on("changeDate", applyDate); - //now assign the date - $("#datepicker" + pickerId).val($scope.model.value); + if ($scope.model.value) { + //manually assign the date to the plugin + $element.find("div:first").datetimepicker("setValue", $scope.model.value); + } //Ensure to remove the event handler when this instance is destroyted $scope.$on('$destroy', function () {