forecast.io
forecast.io copied to clipboard
GetAtTime options not working
This does not work:
var time = new Date(req.params.time);
var opt = {
exclude: 'minutely,hourly,daily,alerts,flags'
};
forecast.getAtTime(req.params.lat, req.params.long, time, opt, function (err, inres, body) {
if (err) {
res.end(JSON.stringify(err));
} else {
res.end(JSON.stringify(body));
}
});
To fix it, I did this:
var time = new Date(req.params.time);
var opt = {
exclude: 'minutely,hourly,daily,alerts,flags'
};
var timesecs = Number(time) / 1000;
forecast.getAtTime(req.params.lat, req.params.long, timesecs, opt, function (err, inres, body) {
if (err) {
res.end(JSON.stringify(err));
} else {
res.end(JSON.stringify(body));
}
});
Care to make a pull request?