No description
Find a file
2023-11-14 12:08:59 +07:00
mm-256-75 adding mm-256-75 images 2023-11-14 11:54:46 +07:00
mm-256-85 adding mm-256-85 images 2023-11-14 12:02:14 +07:00
mm-512-75 adding mm-512-75 images 2023-11-14 12:05:55 +07:00
mm-512-85 adding mm-512-85 images 2023-11-14 12:06:43 +07:00
my-256-75 adding my-256-75 images 2023-11-14 12:07:32 +07:00
my-256-85 adding my-256-85 images 2023-11-14 12:08:59 +07:00
.gitignore initial commit 2023-11-14 11:52:49 +07:00
CHANGELOG.md initial commit 2023-11-14 11:52:49 +07:00
cycleMonth.js initial commit 2023-11-14 11:52:49 +07:00
cycleYear.js initial commit 2023-11-14 11:52:49 +07:00
index.d.ts initial commit 2023-11-14 11:52:49 +07:00
index.js initial commit 2023-11-14 11:52:49 +07:00
LICENSE initial commit 2023-11-14 11:52:49 +07:00
package.json initial commit 2023-11-14 11:52:49 +07:00
README.md initial commit 2023-11-14 11:52:49 +07:00
test.js initial commit 2023-11-14 11:52:49 +07:00

moon-cycle

Simple functions to map a Date() to the current lunar phase and map that to hourly photos of the moon during that phase from NASA.

Yearly takes the full photos for all of 2023 (8760 images) while Monthly take only the cycle starting from November 13 (708 images).

The images have been organized, named, converted to webp, and optimized according to the following structure:

  • "mm" (moon monthly) vs "my" (moon yearly)
  • "256" (256x256 size) vs "512" (512x512 size)
  • "75" (lower quality) vs "85" (higher quality)

Installation

npm install praycalc

Usage

Copy any of the mm or my folders (or both) to your projects "public" directory. Then use as follows:

const { cycleMonth, cycleYear } = require('moon-cycle');

const date = new Date();

// Get results
const mm = cycleMonth(date)
const my = cycleYear(date)

// Print results
console.log(`\nDate = ${date.toISOString()}\nMatch Moon Image URLs to Date..\n`)
console.log(`MM = /mm/${mm}`);
console.log(`MY = /my/${my}`);


Exported functions include cycleMonth and cycleYear

Parameters:

  • result: name of the monthly or yearly webp file

Contributing

Contributions are welcome!

License

ISC License