Found in 3 comments on Hacker News
_jal · 2017-06-09 · Original thread
Time, to me, is the canonical example of "things that people think should be easy, aren't". It has everything - complex, constantly changing "business" rules, exceptions generated essentially randomly by a shadowy cabal[1] nobody's ever heard of, "impossible" situations like the 11 days that never happened and other technically arbitrary calendar edits[2], multiple silly base conversions, really weird rules for picking certain dates[3], lots of opportunities for making fencepost errors, and lots of other things.

Which leads me to my rule with time programming: Never fail to use a solid library, unless you're unfortunate enough to be writing one.

This[4] is a great, necessary but not sufficient book if you have to do that.


[2] For example,



tzs · 2017-05-05 · Original thread
"Easter is a feast, not a planet." --Johannes Kepler

A good reference for anyone who has to write calendar related code is the book "Calendrical Calculations" by Dershowitz and Reingold [1].


Calendar time, when it is done truly right, is a complicated topic. There's a nice book that has way more detail on this than most people actually would want (Calendrical Calculations,

Fresh book recommendations delivered straight to your inbox every Thursday.