mirror of
https://github.com/acamarata/moon-cycle.git
synced 2026-06-30 18:54:29 +00:00
No description
| mm-256-75 | ||
| mm-256-85 | ||
| mm-512-75 | ||
| mm-512-85 | ||
| my-256-75 | ||
| my-256-85 | ||
| .gitignore | ||
| CHANGELOG.md | ||
| cycleMonth.js | ||
| cycleYear.js | ||
| index.d.ts | ||
| index.js | ||
| LICENSE | ||
| package.json | ||
| README.md | ||
| test.js | ||
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