Support YYYY-MM-DD HH:MM:SS format and ISO 8601 format in zdate(), ztime(), and related functions

This commit is contained in:
Kijin Sung 2022-12-24 22:57:18 +09:00
parent 23a827923e
commit 0ed1cfdef7
2 changed files with 68 additions and 23 deletions

View file

@ -78,10 +78,16 @@ class DateTimeTest extends \Codeception\TestCase\Test
// Test zdate() when the internal time zone is different from the default time zone.
Rhymix\Framework\Config::set('locale.internal_timezone', 10800);
$this->assertEquals($expected, zdate('20160128195320'));
$this->assertEquals($expected, zdate('2016-01-28 19:53:20'));
$this->assertEquals($expected, zdate('2016-01-28T23:53:20-07:00'));
$this->assertEquals($expected, zdate('2016-01-28 21:23:20+04:30'));
// Test zdate() when the internal time zone is the same as the default time zone.
Rhymix\Framework\Config::set('locale.internal_timezone', 32400);
$this->assertEquals($expected, zdate('20160129015320'));
$this->assertEquals($expected, zdate('2016-01-29 01:53:20'));
$this->assertEquals($expected, zdate('2016-01-29 05:53:20+13:00'));
$this->assertEquals($expected, zdate('2016-01-28T20:53:20+04:00'));
// Restore the internal timezone.
Rhymix\Framework\Config::set('locale.internal_timezone', 10800);