FAQ: Why Some Zmanim Never Occur (Developers Beware)

Day and night map of the world showing the bands of twilight

Question:

Why do some zmanim never occur in some locations? Developers Beware!

Answer:

While most people realize that the sun may not rise or set in the Arctic and Antarctic Circles (see Rabbi Dovid Heber’s article When Does One Pray When There Is No Day in the Star-K’s Kashrus Kurrents), many are not aware that some twilight dips will not occur during part of the year as far south of the Arctic Circle as London. For example, around the summer solstice in London (on the zmanim map) the sun will never dip far enough below the horizon to reach alos 16.1°. This happens in London from June 5th through July 8th. The image at the top of this post (original at timeanddate.com) shows the various bands of twilight centered on London at midnight on June 21st. Look carefully to see the various bands of twilight. Gateshead will not have alos 16.1° from May 16th through July 28th, while Anchorage, Alaska (yes, there is a frum shul in Anchorage with an interesting davening direction issue that is discussed in the Davening Direction from Alaska post) will not have alos 16.1° from April 24th through August 19th. Zmanim based on sunrise, such as alos 72 that is a 72-minute offset of sunrise, can be calculated as long as sunrise can be calculated, something that will happen as long as you are not in the Arctic or Antarctic Circles.

For this reason, the Zmanim API returns null when a zman will not happen. This applies to both the zmanim, returned as a Java Instant, and the sha’os zmaniyos, returned as a Duration. While an inconvenience to developers who have to code for this, the alternative of a default time would mean that developers unaware of this would display incorrect zmanim, something far worse than a program error from a NullPointerException.

Note: This post has been updated for the KosherJava Zmanim 3.x API. In versions prior to 3.0, zmanim were returned as a Date (null when the zman does not occur), and sha’os zmaniyos were returned as a long number of milliseconds, with Long.MIN_VALUE returned when they could not be calculated.

In recent weeks two publicly available programs using the Zmanim API ran into issues due to nulls returned for early alos times. Being something not anticipated by the developers, the nulls generated errors in the programs that quickly led to fixes. For this reason, Yitzchok updated the Zmanim .NET project to return the nullable DateTime? instead of the regular DateTime that it had previously been returning. While the Zmanim API documentation always indicated that a null could be returned, I modified the documentation to make this clear on the return value documentation for every zman. Code with the modified documentation was part of the recently released Zmanim API 1.2.1.

Leave a Reply

Your email address will not be published. Required fields are marked *

To post code, wrap it in a shortcode for its language, such as [java]…[/java], [js]…[/js] or [php]…[/php], or [code]…[/code] for plain text.