I have this code for calculating the number of days passed from a given year:
for (int currentYear = localDate.getYear() - 1; currentYear >= STARTING_YEAR; currentYear--){
LocalDate date = LocalDate.of(currentYear,5,5); //an arbitrary day of year
jdn += date.lengthOfYear();
}
jdn += localDate.getDayOfYear();
This code is working as expected.
I am not comfortable with choosing an arbitrary day to only get the length of the year. Is there any better approach?