Git Product home page Git Product logo

dark-sky's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

dark-sky's Issues

Daily Time is in 1970

I'm passing the time option and receiving back daily data with UNIX times that are in 1970.

const moment = require('moment');
const DarkSky = require('dark-sky')
const darksky = new DarkSky(DARKSKY_KEY)

exports.weather = (req, res) => {
  try {
    const body = JSON.parse(req.body);
    const { lat, lng, time, units } = body;
	const promises = [];
    
    for (var i = 7; i > 0; i--) {
      promises.push(darksky
      .options({
          latitude: lat,
          longitude: lng,
          time: moment(time).subtract(i, 'days'),
          language: 'en',
          units: units || 'auto',
          exclude: ['minutely', 'hourly']
        })
      .get()
      .then((val) => {
        return val;
      })
      .catch(console.log))
    }
    
    Promise.all(promises).then((result) => {
      res.status(200).json(result);
    });
  } catch (err) {
    next(err)
  }
};

Here's what I get back for one of the daily datasets:

{
  "time": 1517212800,
  "summary": "Clear throughout the day.",
  "icon": "clear-day",
  "sunriseTime": 1517237600,
  "sunsetTime": 1517275281,
  "moonPhase": 0.44,
  "precipIntensity": 0,
  "precipIntensityMax": 0,
  "precipProbability": 0,
  "temperatureHigh": 85.54,
  "temperatureHighTime": 1517266800,
  "temperatureLow": 63.27,
  "temperatureLowTime": 1517320800,
  "apparentTemperatureHigh": 85.54,
  "apparentTemperatureHighTime": 1517266800,
  "apparentTemperatureLow": 63.27,
  "apparentTemperatureLowTime": 1517320800,
  "dewPoint": 26.57,
  "humidity": 0.19,
  "pressure": 1018.59,
  "windSpeed": 3.63,
  "windGust": 12.78,
  "windGustTime": 1517234400,
  "windBearing": 34,
  "cloudCover": 0.02,
  "uvIndex": 4,
  "uvIndexTime": 1517256000,
  "visibility": 10,
  "ozone": 298.78,
  "temperatureMin": 61.35,
  "temperatureMinTime": 1517223600,
  "temperatureMax": 85.54,
  "temperatureMaxTime": 1517266800,
  "apparentTemperatureMin": 61.35,
  "apparentTemperatureMinTime": 1517223600,
  "apparentTemperatureMax": 85.54,
  "apparentTemperatureMaxTime": 1517266800
}
new Date(1517212800) // Sun Jan 18 1970 05:26:52 GMT-0800 (PST)

Celzius, km, cm

Is there a way to choose in which unit data will be returned?

Change over to Pirate Weather? - single line change

Hi,

As Apple is cutting off the DarkSky API for web usage and moving it to WeatherKit, could you possibly move to Pirate Weather, which is created as a "drop in" replacement?

It takes a single line change:
https://github.com/eliashussary/dark-sky/blob/master/dark-sky-api.js#L125

From:
api.darksky.net to api.pirateweather.net

Verified everything on local end works perfectly with this change.

Also -- could you potentially re-publishing the nodejs module as pirate-weather?

"precipIntensity" not found in the response

{moonPhase: 0.4 precipType: "rain" pressure: 1011 pressureError: 3.7 summary: "Partly cloudy throughout the day."}

above shows the part of the response and "precipIntensity" is not there.

Update for Dark Sky API

Forecast.io was recently renamed to Dark Sky (.net), and as such, the API end point as changed, as well as some minor/non-breaking (from first glance) changes.

Refer to the new documentation (finally!) for details:
https://darksky.net/dev/docs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.