Skip to content
This repository has been archived by the owner on Apr 25, 2020. It is now read-only.

Commit

Permalink
restore rise_and_set (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jay LaPorte authored Apr 9, 2019
1 parent 474d3a9 commit 502d16c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/lunar.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,16 +252,24 @@ function transit(ms, lat, lon) {
return julian.from(_transit(julian.to(ms), lat * RAD, lon * RAD));
}

/* In the next 24 hours */
// In the next 24 hours
function rise(ms, lat, lon) {
return julian.from(_rise_and_set(julian.to(ms), lat * RAD, lon * RAD).moonrise);
}

/* In the next 24 hours */
// In the next 24 hours
function set(ms, lat, lon) {
return julian.from(_rise_and_set(julian.to(ms), lat * RAD, lon * RAD).moonset);
}

// Sometimes, you just want everything.
function rise_and_set(ms, lat, lon) {
const x = _rise_and_set(julian.to(ms), lat * RAD, lon * RAD);
x.moonrise = julian.from(x.moonrise);
x.moonset = julian.from(x.moonset);
return x;
}


exports.latitude = latitude;
exports.longitude = longitude;
Expand All @@ -273,3 +281,4 @@ exports.elevation = elevation;
exports.transit = transit;
exports.rise = rise;
exports.set = set;
exports.rise_and_set = rise_and_set;

0 comments on commit 502d16c

Please sign in to comment.