/** * The constructor taking an integer Julian day number assumes that the desired {@link * YearMonthDay} should represent the Gregorian day corresponding to the beginning of the provided * Julian day number. If the {@link JulianDate} is more than one half day later than that, the * calculation will be wrong. * * <p>So, if {@code date} is more than 12 hours past the start of the Julian day, we instead use * the Julian date number of tomorrow. * * @param date The date. * @return The Julian day number that will produce the correct Gregorian day number. */ private static int getAdjustedJulianDayNumber(JulianDate date) { int day = date.getDay(); if (date.getSecondsOfDay() >= 43200.0) { ++day; } return day; }