Skip to content

Commit

Permalink
Fix returning time_utc from the current conditions object.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Apr 2, 2014
1 parent 7722d73 commit 3110917
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions framework/Service_Weather/lib/Horde/Service/Weather/Wwo.php
Expand Up @@ -201,10 +201,17 @@ protected function _getCommonElements($location, $length = Horde_Service_Weather
'extra' => 'localObsTime'));

$results = $this->_makeRequest($url);

// Use the minimum station data provided by forecast request to
// fetch the full station data.
$station = $this->_parseStation($results->data->nearest_area[0]);
// Wwo doesn't include the full station data in the forecast/conditions
// response. Request it.
$station = $this->searchLocations($station->lat . ',' . $station->lon);

// Hack some data to allow UTC observation time to be returned.
$results->data->current_condition[0]->date = new Horde_Date($results->data->current_condition[0]->localObsDateTime);
$results->data->current_condition[0]->date->hour += -$station->getOffset();

// Parse it.
$this->_current = $this->_parseCurrent($results->data->current_condition);

// Sunrise/Sunset
Expand Down

0 comments on commit 3110917

Please sign in to comment.