How Many Days in any Month?

Christopher Clavius

A common problem in working with dates, is to calculate the days of the month for any given month and year. Our current system was proposed by Christopher Clavius and first adopted in 1582. Due to leap years, the rules can get a little tricky.

Here are the rules in English:

So, leap years include 2000 and 2004, but NOT 1900 or 2100.

Here is a perfectly reasonable piece of code to calculate the days of the month for a given month and year:

But, what if, just for fun, we'd like to write this function using the fewest possible characters (instead of going for readability or maintainability)? Try filling in the expression below to evaluate to the number of days in a month, m, for a given year, y (a first attempt has been started for you).

9 characters
Accuracy: 0.00%
Efficiency: 0.00% / char
I wrote a JavaScript expression for the number of days in a month with 0.00% accuracy in only 0 characters. How well can you do?