From 36b050423895e05d6d417cbfb66fa6d18c7d1547 Mon Sep 17 00:00:00 2001 From: Ahmed El-Masry Date: Thu, 27 May 2021 14:55:12 +0200 Subject: [PATCH 1/2] Add the missing semicolon in the package.json Signed-off-by: Ahmed El-Masry --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 64fac8b..3fc3fa0 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,6 @@ "gulp-strip-debug": "^1.0.2", "gulp-uglify": "^1.2.0", "run-sequence": "^1.1.0" - } + }, "homepage": "https://github.com/kineticsocial/angularjs-datetime-picker" } From 0eed32e0685ffc0f7e732506d410f1fec72f3fdc Mon Sep 17 00:00:00 2001 From: Ahmed El-Masry Date: Thu, 27 May 2021 15:26:11 +0200 Subject: [PATCH 2/2] make sure to get the datetime attrs from the UI-Grid input field value if exists Signed-off-by: Ahmed El-Masry --- angularjs-datetime-picker.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/angularjs-datetime-picker.js b/angularjs-datetime-picker.js index e86247d..84618ba 100644 --- a/angularjs-datetime-picker.js +++ b/angularjs-datetime-picker.js @@ -323,6 +323,23 @@ }); element[0].addEventListener('click', function() { + + // make sure to get the datetime attrs from the UI-Grid input field value if exists + var inputValue = element[0].value; + if (inputValue != '') { + var datePart = inputValue.split(' ')[0].split('/'); + attrs.year = datePart[2]; + attrs.month = datePart[0]; + attrs.day = datePart[1]; + + var timePart = inputValue.split(' ')[1]; + if (timePart) { + timePart = timePart.split(':'); + attrs.hour = timePart[0]; + attrs.minute = timePart[1]; + } + } + DatetimePicker.open({ triggerEl: element[0], dateFormat: attrs.dateFormat,