Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

date and time methods for meteorological seasons and date ranges

tag: v0.0.2

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .document
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.markdown
Octocat-spinner-32 Rakefile
Octocat-spinner-32 VERSION.yml
Octocat-spinner-32 time_crisis.gemspec

Arbitrary Date Ranges

You can create a Range with a beginning and end Date using the convenience methods 'for' and 'from'. 'for' will create a range into the future while 'from' creates a range into the past., 'years')
 => Fri, 18 Sep 2009..Sat, 17 Sep 2011, 'years')
 => Wed, 19 Sep 2007..Fri, 18 Sep 2009 

If you want to be more literal in your syntax, you can use the range method directly:, 'months', 'future')
 => Fri, 18 Sep 2009..Tue, 17 Nov 2009, 'months', 'past')
 => Sun, 19 Jul 2009..Fri, 18 Sep 2009 

There is also a class method for defining ranges that allows you to specify a beginning and end for the range, or just one of beginning or end and then the scale (months, years) and unit (number of scale).

Date.range(:begin =>, :scale => 'months', :unit => 3)
 => Fri, 18 Sep 2009..Thu, 17 Dec 2009 

Date.range(:begin => Date.civil(2008, 3, 1), :end => Date.civil(2008, 12, 31))
 => Sat, 01 Mar 2008..Wed, 31 Dec 2008 

Named Months

A range of dates for a month can be created using that month's name, optionally passing in a year.

Date.february # 28 days in feb 2009
 => Sun, 01 Feb 2009..Sat, 28 Feb 2009 

Date.february(2008) # 29 days in feb 2008
 => Fri, 01 Feb 2008..Fri, 29 Feb 2008 

Meteorological Season Calculations

Date.civil(2009, 4, 1).meteorological_spring?
 => true 

Date.civil(2009, 4, 1).meteorological_winter?
 => false 

Date.civil(2009, 10, 1).meteorological_season
 => "fall"
 => Mon, 01 Jun 2009 

Copyright (c) 2009 Travis Tilley. See LICENSE for details.

Something went wrong with that request. Please try again.