Skip to content
This repository was archived by the owner on May 12, 2022. It is now read-only.

Commit e75427f

Browse files
author
Nik Barham
committed
Fixing bug caused by Core\Query and Orm\Time now being in different namespaces
1 parent efd92a1 commit e75427f

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/Automatorm/Orm/Time.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
class Time extends \DateTime
55
{
66
const MYSQL_DATE = 'Y-m-d H:i:s';
7-
public static $format = 'D jS M Y H:i:s T';
8-
public static $display_timezone = 'UTC'; // Default to UTC
7+
public static $display_timezone = 'UTC'; // Default to UTC
98

109
public function __construct($time = 'now', \DateTimeZone $root_timezone = null)
1110
{
@@ -17,23 +16,24 @@ public function __construct($time = 'now', \DateTimeZone $root_timezone = null)
1716
$this->setTimezone(new \DateTimeZone(self::$display_timezone));
1817
}
1918

20-
public function __toString()
21-
{
19+
public function __toString()
20+
{
2221
// Format date (in display timezone)
23-
return $this->format(self::$format);
24-
}
22+
return $this->format(self::MYSQL_DATE);
23+
}
2524

26-
public function mysql()
27-
{
25+
public function mysql()
26+
{
2827
// Store current timezone and set to UTC
29-
$timezone = $this->getTimezone();
28+
$timezone = $this->getTimezone();
3029
$this->setTimezone(new \DateTimeZone('UTC'));
3130

3231
// Get MySQL formatted date in UTC
33-
$datetime = $this->format(self::MYSQL_DATE);
32+
$datetime = $this->format(self::MYSQL_DATE);
3433

3534
// Return to original timezone
3635
$this->setTimezone($timezone);
37-
return $datetime;
38-
}
36+
return $datetime;
37+
}
3938
}
39+

0 commit comments

Comments
 (0)