The fuzzy-date gem provides a way to parse and use incomplete dates, like those found in history or genealogy.
For example, if you know your great-great-great grandmother was born in April, 1836, but you don't know the day of the month, that's not going to work if you try to parse it as a Date object.
With fuzzy-date, when you parse an incomplete date, you'll be given an object of information about the date.
gem install fuzzy-date
require 'rubygems'
require 'fuzzy-date'
fuzzy_date = FuzzyDate::parse( '15 March 1971' )
puts "PARSING: #{ fuzzy_date.original }"
puts "Short date: #{ fuzzy_date.short }"
puts "Long date: #{ fuzzy_date.long }"
puts "Full date: #{ fuzzy_date.full }"
puts "Year: #{ fuzzy_date.year }"
puts "Month: #{ fuzzy_date.month }"
puts "Day: #{ fuzzy_date.day }"
puts "Month name: #{ fuzzy_date.month_name }"
puts "Circa: #{ fuzzy_date.circa }"
puts "Era: #{ fuzzy_date.era }"
If you'd like to hack on FuzzyDate - and we hope you do! - start by forking the repo on GitHub:
https://github.com/davidcole-fuzzydate
The best way to get your changes merged back into core is as follows:
- Clone down your fork
- Create a thoughtfully named topic branch to contain your change
- Hack away
- Add tests and make sure everything still passes by running
rake
- If you are adding new functionality, document it in the README
- Do not change the version number, I'll take care of that
- If necessary, rebase your commits into logical chunks, without errors
- Push the branch up to GitHub
- Send a pull request for your branch
fuzzy-date is released under the MIT License.