Browse Source

Fix ISO 8601 format strings

microsub
J. King 7 years ago
parent
commit
eacada3982
  1. 4
      lib/Misc/DateFormatter.php
  2. 4
      tests/lib/AbstractTest.php

4
lib/Misc/DateFormatter.php

@ -11,7 +11,7 @@ trait DateFormatter {
if($outFormat=="unix") return $date->getTimestamp();
switch ($outFormat) {
case 'http': $f = "D, d M Y H:i:s \G\M\T"; break;
case 'iso8601': $f = "Y-m-dTH:i:s"; break;
case 'iso8601': $f = "Y-m-d\TH:i:s"; break;
case 'sql': $f = "Y-m-d H:i:s"; break;
case 'date': $f = "Y-m-d"; break;
case 'time': $f = "H:i:s"; break;
@ -34,7 +34,7 @@ trait DateFormatter {
if(!is_null($inFormat)) {
switch($inFormat) {
case 'http': $f = "D, d M Y H:i:s \G\M\T"; break;
case 'iso8601': $f = "Y-m-dTH:i:sP"; break;
case 'iso8601': $f = "Y-m-d\TH:i:sP"; break;
case 'sql': $f = "Y-m-d H:i:s"; break;
case 'date': $f = "Y-m-d"; break;
case 'time': $f = "H:i:s"; break;

4
tests/lib/AbstractTest.php

@ -25,8 +25,8 @@ abstract class AbstractTest extends \PHPUnit\Framework\TestCase {
}
function assertTime($exp, $test) {
$exp = $this->dateTransform($exp, "unix");
$test = $this->dateTransform($test, "unix");
$exp = $this->dateTransform($exp, "iso8601");
$test = $this->dateTransform($test, "iso8601");
$this->assertSame($exp, $test);
}

Loading…
Cancel
Save