The period between the first week in December and the first week in January could well be called the "dark days" for the mid-northern latitudes. At latitude 40 degrees north, earliest sunset occurs around 8 December each year, and latest sunrise occurs around 5 January. The day with the least amount of daylight is the winter solstice, the first day of winter, around 21 December. Why are not all these dates the same? The answer is not simple. There are two effects which, together, determine the local time of Sun phenomena, such as sunrise, sunset, and transit. One is called the Equation of Time; the other is the Sun's declination.
The Equation of Time is a way of describing the variation in the time of Sun-related phenomena within our standard 24-hour timekeeping system. In any time zone, the Equation of Time is simply the difference between 12:00 noon on a clock and the actual time of the Sun's transit (sundial noon) across the central meridian of the time zone. The time between successive transits of the Sun - the length of the solar day - varies considerably over the year. It is determined by two factors, both dependent on the position of the Earth in its orbit. Suffice it to say that from mid-November to early February these two factors work together to make the solar day longer than 24 hours: in late December, as much as 30 seconds longer than 24 hours. Since we don't adjust our clocks for this effect, the Sun's transit moves later and later each day during this period.
All other things being equal, the times of all Sun phenomena are tied directly to the time of transit. But all other things are not equal. The Sun's declination, its angular distance above or below the equator, changes on a yearly cycle, causing our seasons. The Sun's declination determines the maximum height of the Sun in the sky on any given day; hence, it also determines the azimuth of the sunrise and sunset points and the length of time the Sun is above the horizon. Most of us know the Sun is at its "lowest point in the sky" on the first day of winter, so we expect the Sun to be above the horizon the least amount of time that day.
So two effects determine the times of sunrise and sunset: the Equation of Time and the Sun's declination. But their relative magnitudes vary. In late December, the daily rate of change of the Sun's declination is quite small and is, of course, zero at the December solstice; "solstice" means "Sun stationary". However, the daily rate of change of the Equation of Time reaches a maximum just a few days later. Thus in late December it is the Equation of Time that has the dominant influence over the changes in sunrise and sunset times from one day to the next. In fact, the Equation of Time dominates, at latitude 40 degrees north, from about 8 December to 5 January. Outside of these few weeks, the Sun's declination changes are dominant. These two dates represent the dates on which the magnitudes of the two effects "cross over" at this latitude. (At higher latitudes, the crossover dates are closer to the solstice since the declination effect is greater there.)
The 8 December crossover day is the date of earliest sunset. Why? In the weeks before solstice, the two effects act in opposite directions on the time of sunset: the declination effect pulling it earlier and the Equation of Time pushing it later. On 8 December the Equation of Time begins to dominate and sunset begins to move later. Meanwhile both effects are pushing sunrise later and later. After solstice, the situation reverses. Both effects push sunset later. But for sunrise, the declination effect now pulls it earlier while the Equation of Time effect continues to push it later. The Equation of Time prevails until 5 January, when the declination effect takes over and sunrises begin to move earlier. So 5 January is the date of latest sunrise.
A similar situation occurs at the summer solstice, although the effect is not as extreme. Solstice occurs around 21 June, but at latitude 40 degrees north the earliest sunrise occurs around 14 June and the latest sunset around 28 June.