[BUGFIX] Check for a valid Date object before opening datepicker
authorPatrick Schriner <patrick.schriner@diemedialen.de>
Fri, 6 May 2011 11:59:43 +0000 (13:59 +0200)
committerSteffen Gebert <steffen.gebert@typo3.org>
Fri, 6 May 2011 17:34:21 +0000 (19:34 +0200)
Fix a regression, while trying to parse the old time when opening
the datepicker would fail on a previously empty datetime field.
Add a check for a valid Date object.

Resolves: #26674
Relates: #25043

Change-Id: Ib435031d0aad56940618c0426cc400965786d891
Reviewed-on: http://review.typo3.org/1942
Reviewed-by: Steffen Gebert
Tested-by: Steffen Gebert
t3lib/js/extjs/tceforms.js

index cd161b8..2153ef6 100644 (file)
@@ -60,7 +60,7 @@ TYPO3.TCEFORMS = {
                                maxDate:        maxDate,
                                handler:        function(picker, date){
                                        var relElement = Ext.getDom(picker.ownerCt.id.substring(1));
-                                       if (index === 1) {
+                                       if (index === 1 && oldValue !== undefined) {
                                                        //datetimefield, preserve time information
                                                date.setHours(oldValue.getHours());
                                                date.setMinutes(oldValue.getMinutes());