lune-esm
Javascript
About
This is an ES module version of Lune.js, a library for calculating the phases(even more) of the moon.
Installation
npm install lune-esm
Usage
Simply import the module:
import { phase } from '/path/to/node_modules/lune-esm/lib/lune.js';
For me, I use it like this:
let phaseValue = phase().phase;
if (this.hour = 12) {
if (phaseValue < .125) {
// new moon
} else if (phaseValue < .25) {
// waxing crescent
} else if (phaseValue < .375) {
// first quarter
} else if (phaseValue < .5) {
// waxing gibbous
} else if (phaseValue < .625) {
// full moon
} else if (phaseValue < .75) {
// waning gibbous
} else if (phaseValue < .875) {
// last quarter
} else {
// waning crescent
}
}
License
This project is licensed under the Apache License 2.0.
For more info, please check out this repo.