Comment

Comment by worstspotgain

Maybe the author wanted to squeeze as many hours out of the task as they could? Plenty of non-top-quartile people love this sort of thing as a day at the beach.

For the diametrical opposite, here's one time on an embedded system where I really didn't want to bring in a library dependency, so I wrote an inconspicuous-looking good-enough version:

   y = (d - (d + 366 + (d >= 47847)) / 1461 + (d >= 47847)) / 365;
   d = d - (d + 365 + (d >= 47848)) / 1461 + (d >= 47848) - y * 365;
   y += 1970;

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton