How many days in a month

The following returns the amount of days in a given year and month, including leap years.

  (, 12, 31) << (12-month)).day

The beauty of Ruby.

Credits to Tim Morgan for his snippet.

This post is open source. Did you spot a mistake? Ideas for improvements? Contribute to this post via Github. Thank you!