vigoren / foundryvtt-simple-calendar

A simple calendar module for the FoundryVTT system
https://simplecalendar.info/
MIT License
46 stars 33 forks source link

[BUG] Moon phases on wrong dates #461

Open FeistyMango opened 1 year ago

FeistyMango commented 1 year ago

Describe the bug I am setting up a Barovian lunar calendar where there are 12 months with 28 days in each month. I've excluded leap years for simplicity and I'm just trying to config it so that the 1st day of every month is a Full Moon as is described in the campaign module. In order to achieve this, I just declare the New moon on the 1st month 14th day.

I can somewhat get this to work correctly however as you move through the calendar months, you start seeing all sorts of issues where a phase icon may appear twice in two consecutive days, or the full moon starts to shift forward or backward over time. Not really sure what is the cause of this. It almost seems like there is a hard coded set of assumptions in using the calculations to place moon phases on the calendar. Either that, or it's operator error and I just can't figure it out. See attached images.

I also used Find the Culprit with just Simple Calendar enabled and the issue was still present.

To Reproduce Steps to reproduce the behavior:

  1. Import this calendar json below
  2. Open the calendar
  3. Cycle through the months and you'll observe that the moon phases are all over the place as you move through months

Expected behavior With this setup, I would expect every month that the Full Moon land on the 1st of every month and a New month to be on the 14th every month. Additionally, I would expect the waxing/wanning icons to fall on the day in the middle a a 6 day period. See config json below

Screenshots image image image image image

Foundry Information

Browser (please complete the following information):

vigoren commented 1 year ago

Hey sorry about the long delay in getting back to you.

Moons are an area that I want to rework to make it better or easier to set up. I think I got it set up to how you want it to be set up. What I changed

That is it in terms of changes, the next few years appear to have the full moon only on the first day of the month and all the other phases follow as expected.

Why phases can appear on more than one day has to do with math rounding when doing to computation on what phase should appear on what day. The 0.5 helps push that rounding error to be less of an issue.

I do plan on updating the moon stuff but I have a few other enhancements I am currently working on at the moment so not sure exactly when it will get looked at.

FeistyMango commented 1 year ago

@vigoren Thank you for the response! Those adjustments got the main four moon phases of the full , first quarter, last quarter, and new moon to work consistently. Now it's just the Waxing/Wanning Gibs/Cresc that are sporadic but they at least appear in the right areas of the calendar when they choose to. Thanks for the explanation of the Cycle Adjustment. I would have never figured out that workaround on my own as I was avoiding it thinking that I have no adjustments since it's a constant 28 lunar cycle calendar month.