https://github.com/richienb/sunrise-api
Get the sunrise and sunset times for a given location.
https://github.com/richienb/sunrise-api
Last synced: 10 months ago
JSON representation
Get the sunrise and sunset times for a given location.
- Host: GitHub
- URL: https://github.com/richienb/sunrise-api
- Owner: Richienb
- License: mit
- Created: 2020-03-20T09:04:26.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-08-14T05:15:47.000Z (over 4 years ago)
- Last Synced: 2025-03-09T17:39:21.959Z (10 months ago)
- Language: JavaScript
- Homepage:
- Size: 86.9 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# sunrise-api [](https://travis-ci.com/Richienb/sunrise-api)
Get the sunrise and sunset times for a given location.
[](https://npmjs.com/package/sunrise-api)
## Install
```sh
npm install sunrise-api
```
## Usage
```js
const sunrise = require("sunrise-api");
(async () => {
await sunrise(-36.8484437, 174.7600023);
/* {
sunrise: '2020-03-19T18:24:27+00:00',
sunset: '2020-03-20T06:32:06+00:00',
solarNoon: '2020-03-20T00:28:16+00:00',
dayLength: 43659,
civilTwilightBegin: '2020-03-19T17:58:41+00:00',
civilTwilightEnd: '2020-03-20T06:57:52+00:00',
nauticalTwilightBegin: '2020-03-19T17:28:29+00:00',
nauticalTwilightEnd: '2020-03-20T07:28:04+00:00',
astronomicalTwilightBegin: '2020-03-19T16:57:52+00:00',
astronomicalTwilightEnd: '2020-03-20T07:58:40+00:00
} */
})();
```
## API
### sunrise(latitude, longitude, options?)
#### latitude
Type: `number`
The Latitude of the location.
#### longitude
Type: `number`
The longitude of the location.
#### options
Type: `object`
##### date
Type: `string`
Default: `today`
Date to get the information for in the `YYYY - MM - DD` format or `today`.
## Attribution
Data provided by https://sunrise-sunset.org/api.