anniversary 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +28 -0
- data/lib/anniversary/version.rb +1 -1
- metadata +4 -3
data/README.markdown
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Anniversary - calculate years, months and days between two dates
|
2
|
+
http://talklikeaduck.denhaven2.com/2011/01/16/they-say-its-your-birthday
|
3
|
+
|
4
|
+
Say you want to show the age of a person on a particular date, say for a medical report document.
|
5
|
+
|
6
|
+
Since my birthday is the eighth of December, I'm Plenty-Nine years, one month, and eight days old today, which happens to be the sixteenth of January.
|
7
|
+
|
8
|
+
Computing that correctly is trickier than it appears at first.
|
9
|
+
|
10
|
+
First I thought this was just a matter of taking the integer part of dividing the difference between the dates by 365.25, and so on. Think again.
|
11
|
+
|
12
|
+
Then I thought there must be some open source solution to this, but every google search I tried for something like "age in years months and days" came back with the same results as if I'd searched for age in years months OR days, which is a horse of a different color.
|
13
|
+
|
14
|
+
Your age in years, is actually the number of birthdays you have had, or to use a more generic term for the yearly recurrence of an event anniversaries, then you count the months between your last birthday anniversary and your last 'monthiversary', then the days since then.
|
15
|
+
|
16
|
+
There are complications since some months are shorter than others, so geting this right is a bit tricky. Hence Anniversary
|
17
|
+
|
18
|
+
## Installation
|
19
|
+
|
20
|
+
gem install anniversary
|
21
|
+
|
22
|
+
## Documentation
|
23
|
+
|
24
|
+
basically this gem adds a few methods to Ruby's Date class. The key one is years_months_days_since which returns an array comprising the years months and days since the argument.
|
25
|
+
|
26
|
+
For details [see the rdoc](http://rdoc.info/github/rubyredrick/anniversary/master/Date)
|
27
|
+
|
28
|
+
For more on the mofivation [see my blog](http://talklikeaduck.denhaven2.com/2011/01/16/they-say-its-your-birthday)
|
data/lib/anniversary/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anniversary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 1
|
10
|
+
version: 1.0.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Rick Denatale
|
@@ -46,6 +46,7 @@ files:
|
|
46
46
|
- .gitignore
|
47
47
|
- .rvmrc
|
48
48
|
- Gemfile
|
49
|
+
- README.markdown
|
49
50
|
- Rakefile
|
50
51
|
- anniversary.gemspec
|
51
52
|
- doc/classes/Anniversary.html
|