jasonsturges / lunarphase-js

Calculate phase of the moon using Julian date
https://jasonsturges.github.io/lunarphase-js/
ISC License
94 stars 14 forks source link

Primary and intermediate phases #24

Open jasonsturges opened 2 years ago

jasonsturges commented 2 years ago

This has come up repeatedly, and need to isolate some notion of primary an intermediary phases.

Primary phases occur at a specific moment in time, and include:

Intermediate phases are ~7.4 days and do not occur at a specific moment in time. They include:

API not yet determined to implement this.

pierroo commented 1 year ago

Hi @jasonsturges just passing by to check if this was implemented since and I missed out? Thanks for the awesome library btw :)

jasonsturges commented 1 year ago

Remind me - were you wanting to see the current phase, or just the ability to pull these as separate values?

Full moon is a specific moment in time, but I think many people want the phase reported as full from that moment to the next phase. Still not entirely sure how to implement that in a clear way....

I'll try to dedicate some more time to this library.

rudolfolah commented 8 months ago

I ended up using another library to get the phase names, there's a function that shows the phases around a given date: https://github.com/ryanseys/lune?tab=readme-ov-file#to-search-for-recent-phases-around-the-current-date

From what I've tried out, the phases are between 5 and 8 days. I used Luxon to create 1-day intervals to cover the points in time (new moon, full moon, first quarter, last quarter) and then created intervals in between them.

jasonsturges commented 8 months ago

@rudolfolah Interesting, I haven't seen this library before.

Yeah, there are tons of packages - https://github.com/cosinekitty/astronomy is one that predicts upcoming phases. Thousands of SLOC available for advanced scientific usage.

Glad you found something that works for you.