Fix issue retrieving timezone data for OpenWeather Map
This commit is contained in:
@@ -229,14 +229,15 @@ function getOWMWeatherData( location, callback ) {
|
|||||||
httpRequest( url, function( data ) {
|
httpRequest( url, function( data ) {
|
||||||
try {
|
try {
|
||||||
data = JSON.parse( data );
|
data = JSON.parse( data );
|
||||||
var weather = {
|
} catch ( err ) {
|
||||||
timezone: timezone,
|
// Otherwise indicate the request failed
|
||||||
sunrise: ( sunData.sunrise.getUTCHours() * 60 + sunData.sunrise.getUTCMinutes() ),
|
callback( false );
|
||||||
sunset: ( sunData.sunset.getUTCHours() * 60 + sunData.sunset.getUTCMinutes() ),
|
}
|
||||||
temp: parseInt( data.main.temp ),
|
|
||||||
humidity: parseInt( data.main.humidity ),
|
getTimeData( location, function( weather ) {
|
||||||
wind: parseInt( data.wind.speed )
|
weather.temp = parseInt( data.main.temp );
|
||||||
};
|
weather.humidity = parseInt( data.main.humidity );
|
||||||
|
weather.wind = parseInt( data.wind.speed );
|
||||||
|
|
||||||
location = location.join( "," );
|
location = location.join( "," );
|
||||||
|
|
||||||
@@ -248,11 +249,7 @@ function getOWMWeatherData( location, callback ) {
|
|||||||
} );
|
} );
|
||||||
|
|
||||||
updateCache( location, weather );
|
updateCache( location, weather );
|
||||||
} catch ( err ) {
|
} );
|
||||||
|
|
||||||
// Otherwise indicate the request failed
|
|
||||||
callback( false );
|
|
||||||
}
|
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user