From 52b503105d389d1796698114573ff618b2ad34a2 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Sat, 7 Jan 2017 14:30:42 +0100 Subject: Improve datetime display Use php-intl extension to display datetimes a bit more nicely, depending on the locale. What changes: * the day is no longer displayed * day number and month are ordered according to the locale * the timezone is more readable (UTC+1 instead of CET) --- tests/languages/en/UtilsEnTest.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/languages/en/UtilsEnTest.php (limited to 'tests/languages/en') diff --git a/tests/languages/en/UtilsEnTest.php b/tests/languages/en/UtilsEnTest.php new file mode 100644 index 00000000..60bcb653 --- /dev/null +++ b/tests/languages/en/UtilsEnTest.php @@ -0,0 +1,25 @@ +assertRegExp('/January 1, 2017 (at )?10:11:12 AM GMT\+0?3(:00)?/', format_date($date, true)); + } + + /** + * Test date_format() using builtin PHP function strftime. + */ + public function testDateFormatDefault() + { + $date = DateTime::createFromFormat('Ymd_His', '20170101_101112'); + $this->assertEquals('Sun 01 Jan 2017 10:11:12 AM EAT', format_date($date, false)); + } +} -- cgit v1.2.3