From ef8f7aa87df26ade02c20549c8dd9a12cabec856 Mon Sep 17 00:00:00 2001 From: Dave Long <dave@longwaveconsulting.com> Date: Wed, 16 Aug 2023 21:45:03 +0100 Subject: [PATCH] Issue #3218087 by nlisgo, Gribnif, Lendude, smustgrave: Views MysqlDateSql::getDateFormat() should translate PHP's 'o' format to MySQL's '%x' --- core/modules/views/src/Plugin/views/query/MysqlDateSql.php | 1 + .../tests/src/Unit/Plugin/views/query/MysqlDateSqlTest.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/core/modules/views/src/Plugin/views/query/MysqlDateSql.php b/core/modules/views/src/Plugin/views/query/MysqlDateSql.php index 00ad873b83a8..07ea4c4a38ae 100644 --- a/core/modules/views/src/Plugin/views/query/MysqlDateSql.php +++ b/core/modules/views/src/Plugin/views/query/MysqlDateSql.php @@ -27,6 +27,7 @@ class MysqlDateSql implements DateSqlInterface { protected static $replace = [ 'Y' => '%Y', 'y' => '%y', + 'o' => '%x', 'M' => '%b', 'm' => '%m', 'n' => '%c', diff --git a/core/modules/views/tests/src/Unit/Plugin/views/query/MysqlDateSqlTest.php b/core/modules/views/tests/src/Unit/Plugin/views/query/MysqlDateSqlTest.php index be5e30d8777a..bbfc7b638e7b 100644 --- a/core/modules/views/tests/src/Unit/Plugin/views/query/MysqlDateSqlTest.php +++ b/core/modules/views/tests/src/Unit/Plugin/views/query/MysqlDateSqlTest.php @@ -65,7 +65,7 @@ public function providerTestGetDateFormat() { return [ ['foo.field', 'Y-y-M-m', '%Y-%y-%b-%m'], ['bar.field', 'n-F D d l', '%c-%M %a %d %W'], - ['baz.bar_field', 'j/W/H-h i s A', '%e/%v/%H-%h %i %s %p'], + ['baz.bar_field', 'o j/W/H-h i s A', '%x %e/%v/%H-%h %i %s %p'], ]; } -- GitLab