File tree Expand file tree Collapse file tree
src/main/java/com/kosherjava/zmanim Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -511,6 +511,23 @@ public Date getSunTransit() {
511511 double noon = getAstronomicalCalculator ().getUTCNoon (getAdjustedCalendar (), getGeoLocation ());
512512 return getDateFromTime (noon , false );
513513 }
514+
515+ /**
516+ * A method that returns "solar" midnight, or the time when the sun is at its <a
517+ * href="https://en.wikipedia.org/wiki/Nadir">nadir</a>. The current calculation is halfway between today and
518+ * tomorrow's {@link #getSunTransit() sun transit}.
519+ *
520+ * @return the <code>Date</code> of astronomical solar midnight. If the calculation can't be computed such as
521+ * when using the {@link com.kosherjava.zmanim.util.SunTimesCalculator USNO calculator} that does not
522+ * support getting solar noon for the Arctic Circle (where there is at least one day a year where the
523+ * sun does not rise, and one where it does not set), a null will be returned. See detailed explanation
524+ * on top of the page.
525+ */
526+ public Date getSolarMidnight () {
527+ AstronomicalCalendar clonedCal = (AstronomicalCalendar ) clone ();
528+ clonedCal .getCalendar ().add (Calendar .DATE , 1 );
529+ return getTimeOffset (getSunTransit (), (clonedCal .getSunTransit ().getTime () - getSunTransit ().getTime ()) / 2 );
530+ }
514531
515532 /**
516533 * A method that returns sundial or solar noon. It occurs when the Sun is <a href
You can’t perform that action at this time.
0 commit comments