Lune
Lune.js — calculate the phases of the moon.
Installation
npm install lune
Usage
To calculate current phase information:
var lune = var current_phase = luneconsole
Output:
phase: 03435664924086369 illuminated: 07773055846628978 age: 101457207715498 distance: 3866797626047325 angular_diameter: 05150467579643708 sun_distance: 1489298460148686 sun_angular_diameter: 05354732715700135
To calculate phase information for a specific date:
var lune = var some_date = '2014-02-17T00:00-0500'var some_date_phase = luneconsole
Output:
phase: 0568204641580006 illuminated: 09547862069882863 age: 16779417556565985 distance: 39608454752883443 angular_diameter: 05028172882344054 sun_distance: 14782248414817196 sun_angular_diameter: 05394845874736046
To search for recent phases around the current date:
var lune = var recent_phases = luneconsole
Output:
new_date: Tue Mar 08 2016 20:55:59 GMT- q1_date: Tue Mar 15 2016 13:04:23 GMT- full_date: Wed Mar 23 2016 08:01:38 GMT- q3_date: Thu Mar 31 2016 11:18:41 GMT- nextnew_date: Thu Apr 07 2016 07:25:20 GMT-
To search for recent phases around a specific date:
var lune = var some_date = '2014-02-17T00:00-0500'var some_date_phase = luneconsole
Output:
new_date: Thu Jan 30 2014 16:40:35 GMT- q1_date: Thu Feb 06 2014 14:22:33 GMT- full_date: Fri Feb 14 2014 18:54:46 GMT- q3_date: Sat Feb 22 2014 12:16:56 GMT- nextnew_date: Sat Mar 01 2014 03:02:41 GMT-
To search for phases between two dates:
// print all full moons in the first quarter of 2014var lune = var phase_list = luneconsole
Possible values for the third argument of the function are:
lune.PHASE_NEW
(new moon)lune.PHASE_FIRST
(first quarter moon)lune.PHASE_FULL
(full moon)lune.PHASE_LAST
(third or last quarter moon)
Output:
Wed Jan 01 2014 06:15:02 GMT- Thu Jan 30 2014 16:40:35 GMT- Sat Mar 01 2014 03:02:41 GMT- Sun Mar 30 2014 14:48:06 GMT-
Image
Moon image graciously provided by Mike DiLuigi.
Contributing
Please feel free to contribute to this project! :) Pull requests and feature requests welcome!
License
See LICENSE file in this repo