Skip to content

Commit bb8a957

Browse files
committed
Don't override the timezone when called with a DateTime object
1 parent ced926c commit bb8a957

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Thumbs.db
2323
#######################
2424
/.vscode
2525
/composer.lock
26+
.phpunit.result.cache
2627
# vim
2728
*~
2829
*.swp

src/php-8.1-strftime.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ function strftime (string $format, $timestamp = null, ?string $locale = null) :
3838
} catch (Exception $e) {
3939
throw new InvalidArgumentException('$timestamp argument is neither a valid UNIX timestamp, a valid date-time string or a DateTime object.', 0, $e);
4040
}
41-
}
4241

43-
$timestamp->setTimezone(new DateTimeZone(date_default_timezone_get()));
42+
$timestamp->setTimezone(new DateTimeZone(date_default_timezone_get()));
43+
}
4444

4545
$locale = Locale::canonicalize($locale ?? (Locale::getDefault() ?? setlocale(LC_TIME, '0')));
4646

0 commit comments

Comments
 (0)