forecast.io icon indicating copy to clipboard operation
forecast.io copied to clipboard

GetAtTime options not working

Open ghost opened this issue 8 years ago • 1 comments

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));
    }
  });

ghost avatar Apr 15 '16 13:04 ghost

Care to make a pull request?

mateodelnorte avatar Sep 22 '16 21:09 mateodelnorte