-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moon.lunarPhase() anticipating moon phase #19
Comments
@sperardt Hi, thanks. Somewhat similar issue as determining when a sunset actually occurs (civil, nautical, or astronomical twilight). It's a rounding issue, which has confused several people. This chart might help:
I think the terms "start" and "end" need clarity, but the "event" is the actual moment in time. So, halfway through the 3.691 days of the phase, it rounds up to the next upcoming cycle. Instead of starting at the moment Application here is like reporting current weather, but several people have expressed either confusion or desire for this to work differently. Some are planning around exact moments in time; others seem to want the phase from event to next event. Any recommendation there as to how you'd like to use / configure this? |
Design wise, I'd like to keep this simple / functional, but I think it's getting to the point there needs to be some kind of options / params config passed to the functions. Some kind of: Moon.function(date, { ...options }) I really like date being the only data model for this, but maybe an options parameter where you could specify:
Or something like that here... |
Hi @jasonsturges ! Yeah, I thought it could be a rounding issue. So, I am using the library on an astrological mobile app where I display the moon phase + a little description about the moon phase. And it got my attention since my moon calendar were saying that was still waning crescent but was getting new moon from the library. Do you know why we are having issues with rounding? I mean, the actual number of decimal places is higher than the ones you listed above? Or it is a Js function you are using that is rounding the number? |
Aff.. I sent the previous comment when I wanted to add a new line haha
|
This operates like a weather app, and rounds on purpose. It will show waning crescent starting 1.85, even though that phase occurs at 3.69 - and will continue to show through 5.54 until the next phase is closer. Several people have contacted me regarding astrology usage - I'm unsure how the phase is leveraged or calcualted, but someone also pointed out that astrological calendars bounce to a 30th lunar day. Lunar vs lunisolar calendars align lunar months with the solar year through different intercalation - approximately 29.5 days, although it appears some calendars alternate between 29 and 30 day synodic months to complete one year of 12 lunations. Here, using the Gregorian calendar, this fraction normalizes years (and leap years) providing accuracy for the next 31,000 years at which point this calculation will be 1-day behind. Think it's time to alter this library to accept a config payload, and I might make the default to start on the day... I'll get back to you shortly. |
Think I'm going to change the calculation to report phase at the event, then add a Although I still like an options payload context. Should have this updated in the next couple of days. |
Thanks @jasonsturges ! |
Still evaluating whether I like this, and need to run test cycles of the next several days, but I've landed at: Moon options, in which cycle start at the event in the northern hemisphere: export type MoonOptions = {
readonly cycleStart: CycleStart;
readonly hemisphere: Hemisphere;
};
export const defaultMoonOptionsFactory = (): MoonOptions => ({
cycleStart: CycleStart.EVENT,
hemisphere: Hemisphere.NORTHERN,
}); |
Hi, I just stumbled into the same "issue" with something executing before the actual full moon due to how the library behaves. I think your suggestion to provide an options/config param is a good approach and we would be able to switch back and forth between different behaviours (exact or rounding) based on what the needs of different applications are. Happy to help if needed (at least with testing). |
@sperardt @protyze I've come to the conclusion that presentation concerns need separation from this calculation. As this was originally used to display graphics, there needs to be angle / percentage functions for visual display separate of reported phase. This is also confounded by primary and intermediary phases. I'm just going to shift this calculation to align with immediate needs. Although, I do like the configuration options - that will assist implementing other feedback, but that will come later. |
That makes sense and people can actually implement their own calculation / phase-mapping using |
Hi Jason! Thanks for creating this library.
I have been using it for a couple of weeks and just noticed that the method
Moon.lunarPhase(date);
is returning "New Moon" phase on Jan 31, 2022 at 5pm EST. However, New Moon is going to be in effect on Feb 01, 2022 at 12:46 am EST.The text was updated successfully, but these errors were encountered: