MDL-81074 core: align core_date::strftime results for numeric and string

This commit is contained in:
Luca Bösch
2024-03-25 09:51:25 +08:00
committed by Andrew Nicols
parent 624a1d8169
commit b2af5134b8
2 changed files with 63 additions and 2 deletions
+2 -2
View File
@@ -717,10 +717,10 @@ class core_date {
// Windows format.
$locale = $locale ?: get_string('locale', 'langconfig');
// The following code is taken from https://github.com/alphp/strftime without modifications.
// The following code is taken from https://github.com/alphp/strftime.
// phpcs:disable
if (!($timestamp instanceof DateTimeInterface)) {
$timestamp = is_int($timestamp) ? '@' . $timestamp : (string) $timestamp;
$timestamp = is_numeric($timestamp) ? '@' . $timestamp : (string) $timestamp;
try {
$timestamp = new DateTime($timestamp);