Skip to content

Fix bug where GetMonthFromJulianDay() would sometimes return the inco…#433

Open
aarebrof wants to merge 1 commit into
holos-aafc:mainfrom
aarebrof:fa/julian-day-bug
Open

Fix bug where GetMonthFromJulianDay() would sometimes return the inco…#433
aarebrof wants to merge 1 commit into
holos-aafc:mainfrom
aarebrof:fa/julian-day-bug

Conversation

@aarebrof
Copy link
Copy Markdown

@aarebrof aarebrof commented May 6, 2026

There appears to be a bug in the GetMonthFromJulianDay() method in the IrrigationService.cs. It does not take into account whether a year is a leap year, and always assumes that February is 28 days long. This results in first-day of months being considered the incorrect month during leap years.

During non-leap years the 60th day of the year is March 1st. But during leap years the 60th day of the year is February 29th. See image below. The same issue persists throughout the year for any month after February.

image

This PR uses the internal DateTime class to figure out what month a day is, then casts the result directly to the Month enumerable value.

@aarebrof
Copy link
Copy Markdown
Author

aarebrof commented May 6, 2026

I'm sorry about all the unrelated changes. We have format on save enabled by default, and it does remove + sort and whitespace formatting. If you want me to, I can disable it when working on Holos code base.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant