Project

General

Profile

Bug #79975 » patch.txt

Mario Matzulla, 2017-03-03 16:12

 
diff --git a/typo3/sysext/core/Classes/DataHandling/DataHandler.php b/typo3/sysext/core/Classes/DataHandling/DataHandler.php
index 3ae0c18..74d5bb4 100644
--- a/typo3/sysext/core/Classes/DataHandling/DataHandler.php
+++ b/typo3/sysext/core/Classes/DataHandling/DataHandler.php
@@ -2735,18 +2735,32 @@
if ((strpos($value, '-') === false && strpos($value, ':') === false) || strpos($value, '-') === 0) {
$value = (int)$value;
} else {
- // ISO 8601 dates
- $dateTime = new \DateTime($value);
- // The returned timestamp is always UTC
- $value = $dateTime->getTimestamp();
- }
- // $value is a UTC timestamp here.
- // The value will be stored in the server’s local timezone, but treated as UTC, so we brute force
- // subtract the offset here. The offset is subtracted instead of added because the value is stored
- // in the timezone, but interpreted as UTC, so if we switched the server to UTC, the correct
- // value would be returned.
- if ($value !== 0 && !$this->dontProcessTransformations) {
- $value -= date('Z', $value);
+ switch ($func) {
+ case 'time':
+ $valueArr = explode(':', $value);
+ $value = $valueArr[0] * 3600 + $valueArr[1] * 60;
+ break;
+ case 'timesec':
+ $valueArr = explode(':', $value);
+ $value = $valueArr[0] * 3600 + $valueArr[1] * 60 + $valueArr[2];
+ break;
+ case 'date':
+ case 'datetime':
+ // ISO 8601 dates
+ $dateTime = new \DateTime($value);
+ // The returned timestamp is always UTC
+ $value = $dateTime->getTimestamp();
+
+ // $value is a UTC timestamp here.
+ // The value will be stored in the server’s local timezone, but treated as UTC, so we brute force
+ // subtract the offset here. The offset is subtracted instead of added because the value is stored
+ // in the timezone, but interpreted as UTC, so if we switched the server to UTC, the correct
+ // value would be returned.
+ if ($value !== 0 && !$this->dontProcessTransformations) {
+ $value -= date('Z', $value);
+ }
+ break;
+ }
}
break;
case 'double2':
(2-2/2)