Skip to content

Migrate to LocalDate, Fix some bugs#253

Merged
KosherJava merged 2 commits intoKosherJava:3-0-modernizationfrom
dickermoshe:3-0-modernization
Mar 16, 2026
Merged

Migrate to LocalDate, Fix some bugs#253
KosherJava merged 2 commits intoKosherJava:3-0-modernizationfrom
dickermoshe:3-0-modernization

Conversation

@dickermoshe
Copy link
Contributor

This PR will replace ZonedDateTime with LocalDate.
The benefit of this change is that the time zone is only in a single location. It is impossible for the timezone in the geolocation class to differ from the timezone in the ZonedDateTime. It also generally makes the entire API more user-friendly. In the past, I've been confused about what time of day the ZonedDateTime should use.

Additionally, this PR fixes a small error in the getSunriseOffsetByDegrees function, Where SolarEvent.SUNSET was being passed to getInstantFromTime.

This PR fixes a bug in getInstantFromTime, which simplifies the calculation by offloading the math to the Java Duration class. There was also an issue where the Instant being returned was incorrectly converting to the local timezone.

Copy link
Owner

@KosherJava KosherJava left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the extensive set of changes. It is interesting that we still need a ZonedDateTime in a few instances (not surprising), but it is not in the publicly facing API.

@KosherJava KosherJava merged commit 3e54af7 into KosherJava:3-0-modernization Mar 16, 2026
1 check failed
@dickermoshe
Copy link
Contributor Author

Thanks, I will now create a set of tests which will compare the results of the old and new api.

Keep in mind that it is impossible to do extensive testing comparing the two becuase:

  1. The new java.time classes behave slightly differently than java.util
  2. The old API had some other bugs which were fixed here Migrate to ICU #249

I'll see what I can do

@KosherJava
Copy link
Owner

Thank you @dickermoshe . While edge cases were fixed by ICU, the main focus is on day-to-day minor changes in old vs. the new, and I appreciate your testing. Try current year for a number of cities with all zmanim compared.

@dickermoshe
Copy link
Contributor Author

Testing java against java is something that I do not know how to do.
The maven/gradle setup is way to confusing to me

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.

2 participants