[!!!][TASK] Remove fixed year 2038 in FormEngine validation JavaScript 88/54488/8
authorFrank Naegler <frank.naegler@typo3.org>
Fri, 27 Oct 2017 15:59:47 +0000 (17:59 +0200)
committerJan Helke <typo3@helke.de>
Thu, 23 Nov 2017 08:27:33 +0000 (09:27 +0100)
This patch removes the fixed year 2038 from the validation.
The validation has been simplified.

Resolves: #81973
Releases: master
Change-Id: If5577b1ce59c8a0310e6a63a8e1ac14dd8944387
Reviewed-on: https://review.typo3.org/54488
Reviewed-by: Andreas Wolf <andreas.wolf@typo3.org>
Tested-by: Andreas Wolf <andreas.wolf@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
typo3/sysext/backend/Resources/Public/JavaScript/FormEngineValidation.js
typo3/sysext/core/Documentation/Changelog/master/Breaking-81973-FormEngineValidationparseDateRemoveFixYear2038.rst [new file with mode: 0644]
typo3/sysext/core/Tests/Acceptance/Backend/Formhandler/ElementsBasicInputCest.php

index 999cee0..da7b1ca 100644 (file)
@@ -716,13 +716,6 @@ define(['jquery', 'moment'], function ($, moment) {
                                }
 
                                var year = (values.values[3]) ? FormEngineValidation.parseInt(values.values[3]) : FormEngineValidation.getYear(today);
-                               if ((year >= 0 && year < 38) || (year >= 70 && year < 100) || (year >= 1902 && year < 2038)) {
-                                       if (year < 100) {
-                                               year = (year < 38) ? year += 2000 : year += 1900;
-                                       }
-                               } else {
-                                       year = FormEngineValidation.getYear(today);
-                               }
                                var usMode = FormEngineValidation.USmode ? 1 : 2;
                                var month = (values.values[usMode]) ? FormEngineValidation.parseInt(values.values[usMode]) : today.getUTCMonth() + 1;
                                usMode = FormEngineValidation.USmode ? 2 : 1;
@@ -731,7 +724,6 @@ define(['jquery', 'moment'], function ($, moment) {
 
                                var theTime = moment.utc();
                                theTime.year(parseInt(year)).month(parseInt(month)-1).date(parseInt(day)).hour(0).minute(0).second(0);
-
                                FormEngineValidation.lastDate = theTime.unix();
                }
                FormEngineValidation.lastDate += add * 24 * 60 * 60;
@@ -836,13 +828,6 @@ define(['jquery', 'moment'], function ($, moment) {
                                        add = FormEngineValidation.pol(values.valPol[2], FormEngineValidation.parseInt(values.values[2]));
                                }
                                var year = (values.values[1]) ? FormEngineValidation.parseInt(values.values[1]) : FormEngineValidation.getYear(today);
-                               if ((year >= 0 && year < 38) || (year >= 70 && year<100) || (year >= 1902 && year < 2038)) {
-                                       if (year < 100) {
-                                               year = (year < 38) ? year += 2000 : year += 1900;
-                                       }
-                               } else {
-                                       year = FormEngineValidation.getYear(today);
-                               }
                                FormEngineValidation.lastYear = year;
                }
                FormEngineValidation.lastYear += add;
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-81973-FormEngineValidationparseDateRemoveFixYear2038.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-81973-FormEngineValidationparseDateRemoveFixYear2038.rst
new file mode 100644 (file)
index 0000000..b0741d9
--- /dev/null
@@ -0,0 +1,40 @@
+.. include:: ../../Includes.txt
+
+========================================================================
+Breaking: #81973 - FormEngineValidation.parseDate remove fixed year 2038
+========================================================================
+
+See :issue:`81973`
+
+Description
+===========
+
+In issue :issue:`81940` the TCA range upper bound was removed.
+But in the file ``typo3/sysext/backend/Resources/Public/JavaScript/FormEngineValidation.js`` in method
+:js:`FormEngineValidation.parseDate` a fixed year 2038 was included.
+
+The result: it was impossible to set a date after year 2038 in datetime fields.
+This limitation is now removed. The date is always set to the current date.
+
+A second problem: It was impossible to enter a date < 100 because there were magically added numbers: 2000 for values
+between 0 and 38 and 1900 for values between 39 and 100.
+
+
+Impact
+======
+
+The magic in calculating date values, e.g. entering 12 will result in 2012, is now removed.
+
+
+Affected Installations
+======================
+
+This affects only the behavior in backend record editing forms. Values of 0 to 100 will not be changed anymore.
+
+
+Migration
+=========
+
+No migration, this behavior was wrong and there is no migration possible.
+
+.. index:: Backend, FlexForm, JavaScript, NotScanned
index 12a592a..95fdbc4 100644 (file)
@@ -183,9 +183,9 @@ class ElementsBasicInputCest extends AbstractElementsBasicCest
                 ],
                 [
                     'inputValue' => '12',
-                    'expectedValue' => '2012',
-                    'expectedInternalValue' => '2012',
-                    'expectedValueAfterSave' => '2012',
+                    'expectedValue' => '12',
+                    'expectedInternalValue' => '12',
+                    'expectedValueAfterSave' => '12',
                     'comment' => '',
                 ],
                 [