Latest sunrise and earliest sunset

Here’s a fun post by Andrew Plotkin. He’s a late riser, so the shortest day of the year, which is on the solstice, means nothing to him. He’s interested in the date of the earliest sunset, because that means his sunlight hours will be increasing after that date. He calls it the Nighthawk’s Solstice and figures that it’s today, December 8.

But there’s some ambiguity:

It’s a bit tricky to pin down which day this is. There’s a million ad-encrusted sites which show you sunset times, but they mostly work in minutes, which means there’s a stretch of days which are “the earliest”. It’s the bottom of a long flat curve.

He could avoid the ads by going to this US Naval Observatory website. But that won’t solve the long flat curve problem. He’s run into the same problem I did a couple of years ago when I was trying to position the “Sunrise” and “Sunset” labels on my sunlight plots.

Chicago, IL-2023

As I said back then:

Because the USNO data reports the sunrises and sunsets to the nearest minute, the minimum value of sunrise and maximum value of sunset last for several days. I want the labels to be centered within those stretches.

What’s true for the earliest sunrise and latest sunset is also true for the latest sunrise and earliest sunset. My solution for positioning the labels was the same as Andrew’s solution for fixing the date of Nighthawk’s Solstice: picking the date in the middle of the flat stretch.

Since I’ve been using Mathematica a lot lately, I wondered if I could do better. And I can. Mathematica has Sunrise and Sunset functions that return the dates and times to the nearest second. So I made this short notebook to find the latest sunrise and earliest sunset for Naperville, Illinois, where I live:

It first sets the location for all the calculations to the Nichols Library in downtown Naperville and circles the location on a satellite view. It then uses the DateRange and DateObject functions to build a list of dates from the beginning of December to the middle of January.

Passing that list of dates to Sunrise and Sunset returns an EventSeries for each. The Values property for these series extracts just the time and date for each sunrise and sunset. Finally, using MaximalBy pulls out the sunrise with the latest time. Similarly, using MinimalBy for the sunsets gets the sunset with the earliest time.

As you can see, Andrew’s eyeball estimate of December 8 as the earliest sunset is correct.1 So today is (or was—I’m typing this after sunset) Nighthawk’s Solstice.

A few comments:

  1. If you look carefully at the documentation for Sunrise and Sunset, you’ll see that they have lots of options for zeroing in on exactly what kind of sunrise or sunset you’re calculating. Are you looking for when the middle of the sun is at the horizon? The upper limb? The lower limb? And are you accounting for refraction? What about elevation? As you can see from the code, I’m accepting Mathematica’s defaults for all of those options. I’m not especially worried about any imprecision that might creep in because of this. I don’t care about the exact rise and set times, only in how they change from day to day. As long as I’m consistent in the method of calculation, the dates of the minimum and maximum should be correct.
  2. Since I’ve brought up refraction, you might well argue that Mathematica’s calculations of sunrise and sunset to the nearest second is bullshit. The refractive index of air changes with the weather, so you’ll never know sunrise or sunset with that kind of precision. I would just say that Sunrise and Sunset use consistent assumptions that allow the calculations to proceed, real world observations notwithstanding.
  3. If you’re wondering why the latest sunrise and earliest sunset don’t match up with the winter solstice, you should look into the equation of time. Today, solar noon here in Naperville was about 15 minutes before the noon on our watches.2 Sunrise and sunset are about equally spaced on either side of solar noon, so that means sunrise was about 4 hours and 53 minutes before watch noon and sunset was about 4 hours and 22 minutes after watch noon. It is that difference between solar and watch time that makes the earliest sunset happen before the solstice and the latest sunrise happen after.

  1. At least it’s correct for Naperville. It could be off by a day for other locations. 

  2. Some of this difference is due to the equation of time and some is due to Naperville being in the eastern part of the US/Central time zone.