News for hackers. Stuff that matters.
Re:Show HN: Moon Phase Algorithms for C, Lua, Awk, JavaScrip... by oliverkwebb on Monday June 02, 2025 @01:36AM (#44156058)
This discrepancy with time is explained in the book the algorithm is based on (Practical Astronomy with Your Calculator, which also does a good job explaining a ton of other ideas and models in astronomical calculation).

January 0th makes sense because a year starts on January 1st. You count days of the year from 1 instead of from 0. So if we are going by the day of the year, day 1 of the year should be Jan1, the consequence of this being that Jan0 exists and is Dec31 of the prev year.

I originally got into this because of my status bar on i3, hacking together C code from moontool into https://github.com/oliverkwebb/moontool about a year back.

Re:Show HN: Moon Phase Algorithms for C, Lua, Awk, JavaScrip... by hulitu on Thursday June 05, 2025 @01:38AM (#44188593)
> January 0th makes sense because a year starts on January 1st. You count days of the year from 1 instead of from 0. So if we are going by the day of the year, day 1 of the year should be Jan1, the consequence of this being that Jan0 exists and is Dec31 of the prev year.

That's how bugs get introduced. /s