phronos / calculate_age
- Source
- Commits
- Network (1)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Tree:
df6c969
Christopher D Warren (author)
Wed Oct 14 07:07:57 -0700 2009
commit df6c969a448aa0499151ac6fc037b0e78ee29211
tree bfdb0f2663161306f73e4e8ed0a06c81c7a300da
parent 4c7de5f82d99f350522a1d5ebb0597e185bca0d2
tree bfdb0f2663161306f73e4e8ed0a06c81c7a300da
parent 4c7de5f82d99f350522a1d5ebb0597e185bca0d2
| name | age | message | |
|---|---|---|---|
| |
MIT-LICENSE | ||
| |
README.md | ||
| |
Rakefile | ||
| |
init.rb | ||
| |
install.rb | ||
| |
lib/ | ||
| |
test/ | ||
| |
uninstall.rb |
README.md
CalculateAge
CalculateAge makes it easy to figure out age in days, weeks, months, or years. By default it assumes you want the age until today, but any end date can be provided.
It returns the age as you'd expect, especially when dealing with months and weeks.
Example
CalculateAge.of("10/13/2009", :in => "years") #=> "1 year" CalculateAge.of("9/8/2009", :in => "months") #=> "11 months" CalculateAge.of("10/5/2009", :in => "weeks") #=> "14 weeks" CalculateAge.of("3/23/2009", :in => "days") #=> "16 days" CalculateAge.of("4/17/2009", :in => "years and months") #=> "2 years and 3 months" CalculateAge.of("4/17/2009", :in => "years and months", :at => "7/19/2011") #=> "2 years and 3 months"
Credits
Copyright (c) 2009 Phronos, released under the MIT license

