mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Added "Config.timezone" config param to avoid having to specify timezone in each function call.
This commit is contained in:
parent
d34f0c2bd8
commit
ebf304927b
2 changed files with 9 additions and 0 deletions
|
@ -630,6 +630,11 @@ class CakeTimeTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Time->fromString(time(), $timezoneServer);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
Configure::write('Config.timezone', $timezoneServer->getName());
|
||||
$result = $this->Time->fromString(time());
|
||||
$this->assertEquals($expected, $result);
|
||||
Configure::delete('Config.timezone');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -243,6 +243,10 @@ class CakeTime {
|
|||
$date = strtotime($dateString);
|
||||
}
|
||||
|
||||
if ($timezone === null) {
|
||||
$timezone = Configure::read('Config.timezone');
|
||||
}
|
||||
|
||||
if ($timezone !== null) {
|
||||
return self::convert($date, $timezone);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue