[TASK] Consistent date and time rendering in FormEngine 41/57041/3
authorGeorg Ringer <georg.ringer@gmail.com>
Wed, 23 May 2018 09:07:30 +0000 (11:07 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Wed, 30 May 2018 08:59:06 +0000 (10:59 +0200)
Use methods of BackendUtility to have a consistent look of date and
time fields in the backend.

Resolves: #85002
Releases: master, 8.7
Change-Id: I6f0b6aca1530524ff3f83922a1b4b2dd72b1ea84
Reviewed-on: https://review.typo3.org/57041
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Tested-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/backend/Classes/Form/Element/AbstractFormElement.php
typo3/sysext/backend/Tests/Unit/Form/Element/AbstractFormElementTest.php

index 5ac5869..8f26b9c 100644 (file)
@@ -220,19 +220,19 @@ abstract class AbstractFormElement extends AbstractNode
             case 'datetime':
                 // compatibility with "eval" (type "input")
                 if ($itemValue !== '' && $itemValue !== null) {
-                    $itemValue = date('H:i d-m-Y', (int)$itemValue);
+                    $itemValue = BackendUtility::datetime((int)$itemValue);
                 }
                 break;
             case 'time':
                 // compatibility with "eval" (type "input")
                 if ($itemValue !== '' && $itemValue !== null) {
-                    $itemValue = gmdate('H:i', (int)$itemValue);
+                    $itemValue = BackendUtility::time((int)$itemValue, false);
                 }
                 break;
             case 'timesec':
                 // compatibility with "eval" (type "input")
                 if ($itemValue !== '' && $itemValue !== null) {
-                    $itemValue = gmdate('H:i:s', (int)$itemValue);
+                    $itemValue = BackendUtility::time((int)$itemValue);
                 }
                 break;
             case 'year':
index 9ff377d..0dc0e81 100644 (file)
@@ -82,7 +82,7 @@ class AbstractFormElementTest extends UnitTestCase
                     'format' => 'datetime',
                 ],
                 '1412358894',
-                '17:54 03-10-2014'
+                '03-10-14 17:54'
             ],
             'format to datetime with empty value' => [
                 [