Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nfischer/sunrisesunsetcalculator
A javascript module for calculating the sunrise and sunset on an arbitrary day
https://github.com/nfischer/sunrisesunsetcalculator
Last synced: about 1 month ago
JSON representation
A javascript module for calculating the sunrise and sunset on an arbitrary day
- Host: GitHub
- URL: https://github.com/nfischer/sunrisesunsetcalculator
- Owner: nfischer
- License: mit
- Created: 2016-02-22T03:20:42.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-02-22T03:32:32.000Z (almost 9 years ago)
- Last Synced: 2024-10-14T12:37:51.947Z (3 months ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
SunriseSunsetCalculator
=======================This is a Javascript implementation of [this
algorithm](http://williams.best.vwh.net/sunrise_sunset_algorithm.htm). This npm
module is designed to be consistent with the [corresponding Python
module](https://github.com/jebeaudet/SunriseSunsetCalculator/). Any
inconsistencies should be reported in the bug tracker for either this project or
the Python project (I'm monitoring both).Usage
-----```Javascript
var ssc = require('sunrisesunsetcalculator');var latitude = 46.805;
var longitude = -71.2316;
var zenith = ssc.CIVIL_ZENITH;
var localOffset = -5; // Eastern standard timevar rightNow = new Date();
var riseSetObj = new ssc.SunriseSunset(rightNow, latitude, longitude,
/* optional */ localOffset, /* optional */ zenith);
var output = riseSetObj.calculate();console.log('Using information for Quebec City');
console.log('Sunrise', output.riseTime);
console.log('Sunset', output.setTime);// Or like this...
// You can shuffle the order of arguments by passing it in as an object
var input = {latitude: 34.0500, longitude: 118.2500, zenith: ssc.CIVIL_ZENITH, date: new Date()};
output = new ssc.SunriseSunset(input).calculate();console.log('Using information for Los Angeles, CA');
console.log('Sunrise', output.riseTime);
console.log('Sunset', output.setTime);
```