ProductPromotion
Logo

Java.Script

made by https://0x3d.site

GitHub - ryanseys/lune: :new_moon: Lune.js — Calculate the phases of the moon
:new_moon: Lune.js — Calculate the phases of the moon - ryanseys/lune
Visit Site

GitHub - ryanseys/lune: :new_moon: Lune.js — Calculate the phases of the moon

GitHub - ryanseys/lune: :new_moon: Lune.js — Calculate the phases of the moon

Lune Build Status

Lune.js — calculate the phases of the moon.

Installation

npm install lune

Usage

To calculate current phase information:

var lune = require('lune')
var current_phase = lune.phase()
console.log(current_phase)

Output:

{ phase: 0.3435664924086369,
  illuminated: 0.7773055846628978,
  age: 10.1457207715498,
  distance: 386679.7626047325,
  angular_diameter: 0.5150467579643708,
  sun_distance: 148929846.0148686,
  sun_angular_diameter: 0.5354732715700135 }

To calculate phase information for a specific date:

var lune = require('lune')
var some_date = new Date('2014-02-17T00:00-0500')
var some_date_phase = lune.phase(some_date)
console.log(some_date_phase)

Output:

{ phase: 0.568204641580006,
  illuminated: 0.9547862069882863,
  age: 16.779417556565985,
  distance: 396084.54752883443,
  angular_diameter: 0.5028172882344054,
  sun_distance: 147822484.14817196,
  sun_angular_diameter: 0.5394845874736046 }

To search for recent phases around the current date:

var lune = require('lune')
var recent_phases = lune.phase_hunt()
console.log(recent_phases)

Output:

{ new_date: Tue Mar 08 2016 20:55:59 GMT-0500 (EST),
  q1_date: Tue Mar 15 2016 13:04:23 GMT-0400 (EDT),
  full_date: Wed Mar 23 2016 08:01:38 GMT-0400 (EDT),
  q3_date: Thu Mar 31 2016 11:18:41 GMT-0400 (EDT),
  nextnew_date: Thu Apr 07 2016 07:25:20 GMT-0400 (EDT) }

To search for recent phases around a specific date:

var lune = require('lune')
var some_date = new Date('2014-02-17T00:00-0500')
var some_date_phase = lune.phase_hunt(some_date)
console.log(some_date_phase)

Output:

{ new_date: Thu Jan 30 2014 16:40:35 GMT-0500 (EST),
  q1_date: Thu Feb 06 2014 14:22:33 GMT-0500 (EST),
  full_date: Fri Feb 14 2014 18:54:46 GMT-0500 (EST),
  q3_date: Sat Feb 22 2014 12:16:56 GMT-0500 (EST),
  nextnew_date: Sat Mar 01 2014 03:02:41 GMT-0500 (EST) }

To search for phases between two dates:

// print all full moons in the first quarter of 2014
var lune = require('lune')
var phase_list = lune.phase_range(
  new Date('2014-01-01T00:00:00.000Z'),
  new Date('2014-03-31T23:59:59.999Z'),
  lune.PHASE_FULL
)
console.log(phase_list)

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-0500 (EST),
  Thu Jan 30 2014 16:40:35 GMT-0500 (EST),
  Sat Mar 01 2014 03:02:41 GMT-0500 (EST),
  Sun Mar 30 2014 14:48:06 GMT-0400 (EDT) ]

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

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory