[BUGFIX] Date of 1970-01-01 is shown in unset date fields
authorSteffen Gebert <steffen.gebert@typo3.org>
Thu, 7 Jul 2011 20:30:40 +0000 (22:30 +0200)
committerSteffen Gebert <steffen.gebert@typo3.org>
Thu, 7 Jul 2011 20:34:34 +0000 (22:34 +0200)
The backend shows 1970-01-01 since TYPO3 4.3, even though this
value is empty. I know that there is a problem with mySQL that
cannot differentiate between "0" and NULL, and that this is a
more difficult problem. In any case, even though showing
1970-01-01 is "valid", this is just a bad thing in terms of
usability and user-friendly-ness.

Resolves: #27936
Releases: 4.6, 4.5, 4.4, 4.3

Change-Id: Ib86b77e76294ab5bc4ed7d7aebc8c99c2f1f35ae
Reviewed-on: http://review.typo3.org/3113
Reviewed-by: Steffen Gebert
Tested-by: Steffen Gebert
t3lib/class.t3lib_befunc.php

index e571d5a..e148e15 100644 (file)
@@ -2269,7 +2269,12 @@ final class t3lib_BEfunc {
                                        }
                                break;
                                case 'input':
-                                       if (isset($value)) {
+                                               // currently, this feature does not show "0" or the date
+                                               // "1970-01-01", but this is a DB limitation, as we cannot
+                                               // differentiate between "0" and "NULL" in the DB
+                                               // however, this solution is the most "user-friendly" for
+                                               // 99.9% percent of all use-cases.
+                                       if (!empty($value)) {
                                                if (t3lib_div::inList($theColConf['eval'], 'date')) {
                                                        $l = t3lib_BEfunc::date($value) .
                                                                ' (' .