Skip to content

Comment on Fix date-handling bug when today’s date is later than the target monthparent

Comments

In non-leap years, there are potential invalid target months when the current date is January 29th, January 30th, January 31st, March 29th, March 30th, March 31st, April 29th, April 30th, May 29th, May 30th, May 31st, June 29th, June 30th, July 29th, July 30th, July 31st, August 29th, August 30th, August 31st, September 29th, September 30th, October 29th, October 30th, October 31st, November 29th, November 30th, December 29th, December 30th, or December 31st.

That is, the number of days of a given year where this bug applies are: 3 in January, 3 in March, 2 in April, 3 in May, 2 in June, 3 in July, 3 in August, 2 in September, 3 in October, 2 in November, and 3 in December.

3+3+2+3+2+3+3+2+3+2+3

Where did the 5 come from?

The original title on HN said that there was a bug that applied on five days out of the year. I contend it applies more often than that.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.