solcalc is a JavaScript library for calculating exact sunrise and sunset times for a given location, based on the implementation of the NOAA Solar Calculator.
Times are mathematically acurate for the given day and final times are not rounded. NOAA Solar Calculator rounds time to the nearest minute and may differ slightly from the results here.
$ npm install --save solcalc
const solcalc = require('solcalc');
solcalc.getTimes(/*Moment*/ date, /*Number*/ latitude, /*Number*/ longitude)
Returns an object with the following properties (each is a Moment
object):
Property | Description |
---|---|
sunrise |
sunrise |
sunset |
sunrise ends |
solarNoon |
./solcalc
Usage: index [options]
A Javascript module used to calculate sunrise, and sunset based on the NOAA Calculations
Options:
-h, --help output usage information
-V, --version output the version number
-l, --latitude <n>* latitude
-g, --longitude <n>* longitude
-d, --date [YYYY-MM-DD] date in YYYY-MM-DD format, defaults to current date
LGPL-3.0 © yitz