Skip to content
Merged

Master #3064

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/playground/blocks/block_expansion_weather.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ const { getStateOptions, getCityOptions, locationData } = require('../../util/lo
const { callApi } = require('../../util/common');

function resolveData(weatherData, type, dateStr) {
const defaultData = Entry.EXPANSION_BLOCK.weather.defaultData;
try {
let key = Entry.EXPANSION_BLOCK.weather.getDate(dateStr);
if (type === 'now') {
return weatherData[Object.keys(weatherData)[0]];
key = Object.keys(weatherData)[0];
} else if (type === 'hour') {
return weatherData[dateStr];
} else {
return weatherData[Entry.EXPANSION_BLOCK.weather.getDate(dateStr)];
key = dateStr;
}
return weatherData[key] || defaultData;
} catch (e) {
return Entry.EXPANSION_BLOCK.weather.defaultData;
return defaultData;
}
}

Expand Down
Loading