Class: ISO8601::Months

Inherits:
Atom
  • Object
show all
Defined in:
lib/iso8601/atoms.rb

Overview

A Months atom in a Duration

A “calendar month” is the time interval resulting from the division of a “calendar year” in 12 time intervals.

A “duration month” is the duration of 28, 29, 30 or 31 “calendar days” depending on the start and/or the end of the corresponding time interval within the specific “calendar month”.

Instance Method Summary collapse

Methods inherited from Atom

#initialize, #to_i, #to_seconds

Constructor Details

This class inherits a constructor from ISO8601::Atom

Instance Method Details

#factorObject

The Month factor

The “duration month” average is calculated through time intervals of 400 “duration years”. Each cycle of 400 “duration years” has 303 “common years” of 365 “calendar days” and 97 “leap years” of 366 “calendar days”.



80
81
82
83
84
85
86
87
88
# File 'lib/iso8601/atoms.rb', line 80

def factor
  if @base.nil?
    nobase_calculation
  elsif @atom == 0
    zero_calculation
  else
    calculation
  end
end