Module: Jiff::MonthMapper

Defined in:
lib/jiff/month_mapper.rb

Overview

Simple mapper between month and number of days

Constant Summary collapse

DAYS_MONTH =
[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31].freeze

Class Method Summary collapse

Class Method Details

.days_in_month(date) ⇒ Object



6
7
8
9
10
11
# File 'lib/jiff/month_mapper.rb', line 6

def self.days_in_month(date)
  month = date.month
  return 29 if month == 2 && Date.gregorian_leap?(date.year)

  DAYS_MONTH[month - 1]
end