Skip to content

Commit c8706f3

Browse files
committed
Merge pull request #21 from peterbulmer/master
sun: change constructor to expect utctime rise&set issue #20
2 parents 6ea0eda + fcf678b commit c8706f3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Cmfcmf/OpenWeatherMap/CurrentWeather.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,9 @@ public function __construct($xml, $units)
110110

111111
$this->clouds = new Unit($xml->clouds['value'], null, $xml->clouds['name']);
112112
$this->precipitation = new Unit($xml->precipitation['value'], $xml->precipitation['unit'], $xml->precipitation['mode']);
113-
$this->sun = new Sun(new \DateTime($xml->city->sun['rise']), new \DateTime($xml->city->sun['set']));
113+
$utctz = new \DateTimeZone('UTC');
114+
$this->sun = new Sun(new \DateTime($xml->city->sun['rise'], $utctz), new \DateTime($xml->city->sun['set'], $utctz));
114115
$this->weather = new WeatherObj($xml->weather['number'], $xml->weather['value'], $xml->weather['icon']);
115-
$this->lastUpdate = new \DateTime($xml->lastupdate['value']);
116+
$this->lastUpdate = new \DateTime($xml->lastupdate['value'], $utctz);
116117
}
117118
}

0 commit comments

Comments
 (0)