# sunrise-api

> Get the sunrise and sunset times for a given location.

Latest version **1.0.0** (published 2020-03-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install sunrise-api
pnpm add sunrise-api
yarn add sunrise-api
bun add sunrise-api
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-03-20 |
| First published | 2020-03-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 4 |
| Unpacked size | 5.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Richie Bendall |
| Maintainers | richienb |
| Keywords | sunrise, api, request, get, fetch, lookup |

## Links

- npm: https://www.npmjs.com/package/sunrise-api
- Repository: https://github.com/Richienb/sunrise-api
- npm.io page: https://npm.io/package/sunrise-api

## Dependencies (4)

- [ky](https://npm.io/package/ky.md) ^0.19.0
- [ky-universal](https://npm.io/package/ky-universal.md) ^0.5.0
- [camelcase-keys](https://npm.io/package/camelcase-keys.md) ^6.2.1
- [@sindresorhus/is](https://npm.io/package/@sindresorhus/is.md) ^2.1.0

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2020-03-20

## README

# sunrise-api [![Travis CI Build Status](https://img.shields.io/travis/com/Richienb/sunrise-api/master.svg?style=for-the-badge)](https://travis-ci.com/Richienb/sunrise-api)

Get the sunrise and sunset times for a given location.

[![NPM Badge](https://nodei.co/npm/sunrise-api.png)](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.

---
_Source: https://npm.io/package/sunrise-api · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
