Module RiCal::CoreExtensions::Time::Calculations
In: lib/ri_cal/core_extensions/time/calculations.rb
  • ©2009 Rick DeNatale
  • All rights reserved. Refer to the file README.txt for the license
 Provide calculation methods for use by the RiCal gem
 This module is included by Time, Date, and DateTime

Methods

Public Class methods

Convert the receivers wday to RFC 2445 format. Whereas the Ruby time/date classes use 0 to represent Sunday, RFC 2445 uses 7.

Return the date on which the first iso week with a given starting week day occurs for a given iso year

From RFC 2445 page 43: A week is defined as a seven day period, starting on the day of the week defined to be the week start (see WKST). Week number one of the calendar year is the first week which contains at least four (4) days in that calendar year.

parameters

year:the iso year
wkst:an integer representing the day of the week on which weeks are deemed to start. This uses

the ruby convention where 0 represents Sunday.

Public Instance methods

Return the number of days in the month which includes the receiver

return the iso week number of the receiver

parameter

wkst:an integer representing the day of the week on which weeks are deemed to start. This uses

the ruby convention where 0 represents Sunday.

return the number of weeks in the the iso year containing the receiver

parameter

wkst:an integer representing the day of the week on which weeks are deemed to start. This uses

the ruby convention where 0 represents Sunday.

return the iso year of the receiver

parameter

wkst:an integer representing the day of the week on which weeks are deemed to start. This uses

the ruby convention where 0 represents Sunday.

Return an array containing the iso year and iso week number for the receiver. Note that the iso year may be the year before or after the calendar year containing the receiver.

parameter

wkst:an integer representing the day of the week on which weeks are deemed to start. This uses

the ruby convention where 0 represents Sunday.

return the first day of the iso year of the receiver

parameter

wkst:an integer representing the day of the week on which weeks are deemed to start. This uses

the ruby convention where 0 represents Sunday.

A predicate method used to determine if the receiver is within a leap year

[Validate]