From 502d16cc54f63812b85709705a9b464bc3507c3c Mon Sep 17 00:00:00 2001 From: Jay LaPorte Date: Tue, 9 Apr 2019 16:10:40 -0400 Subject: [PATCH] restore rise_and_set (#16) --- lib/lunar.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/lunar.js b/lib/lunar.js index 30998a8..63ba542 100644 --- a/lib/lunar.js +++ b/lib/lunar.js @@ -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; @@ -273,3 +281,4 @@ exports.elevation = elevation; exports.transit = transit; exports.rise = rise; exports.set = set; +exports.rise_and_set = rise_and_set;