Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Ruby gem for generating date objects from a date duration string (eg. 'September 9th-12th, 2012')
Ruby
branch: master

This branch is 5 commits behind SeanRoberts:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.gitignore
README.md
Rakefile
datesplit.gemspec

README.md

Datesplit

Datesplit is a gem for converting date duration strings such as "August 14th to September 21st, 2012" into date objects. It piggybacks heavily off of Date#parse.

Usage

Datesplit has only 3 public methods: start_date, end_date, and duration. Each does pretty much what you would expect.

dates = Datesplit.new('April 9th to April 20th, 2012')
dates.start_date.to_s    # Returns #<Date: 4912053/2,0,2299161>
dates.end_date.to_s      # Returns #<Date: 4912075/2,0,2299161>
dates.duration           # Returns 11

Formats

A list of formats that Datesplit undestands can be found in the spec/datesplit_spec.rb. This list is small but growing.

Something went wrong with that request. Please try again.