Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added "Config.timezone" config param to avoid having to specify timez…

…one in each function call.
  • Loading branch information...
commit ebf304927b80ec77ca27324f2e67c8aa7f647f63 1 parent d34f0c2
@ADmad ADmad authored
View
5 lib/Cake/Test/Case/Utility/CakeTimeTest.php
@@ -630,6 +630,11 @@ public function testUserOffset() {
$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');
}
/**
View
4 lib/Cake/Utility/CakeTime.php
@@ -243,6 +243,10 @@ public static function fromString($dateString, $timezone = null) {
$date = strtotime($dateString);
}
+ if ($timezone === null) {
+ $timezone = Configure::read('Config.timezone');
+ }
+
if ($timezone !== null) {
return self::convert($date, $timezone);
}
Please sign in to comment.
Something went wrong with that request. Please try again.