# File lib/runt/temporalexpression.rb, line 251
  def max_day_of_month(date)
    # Contributed by Justin Cunningham who took it verbatim from the Rails 
    # ActiveSupport::CoreExtensions::Time::Calculations::ClassMethods module 
    # days_in_month method. 
    month = date.month
    year = date.year
    if month == 2
      !year.nil? && 
        (year % 4 == 0) && 
        ((year % 100 != 0) || 
         (year % 400 == 0)) ?  29 : 28
    elsif month <= 7
      month % 2 == 0 ? 30 : 31
    else
      month % 2 == 0 ? 31 : 30
    end
  end