Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

date_diff

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

date_diff - rubygems Package Compare versions

Comparing version
0.0.1
to
0.0.2
+7
.travis.yml
language: ruby
script: "rake test"
rvm:
- 1.8.7
- 1.9.2
- 1.9.3
+13
-3

@@ -23,7 +23,17 @@ # coding: utf-8

spec.add_development_dependency "rake"
spec.add_development_dependency "activesupport"
spec.add_development_dependency "i18n"
if RUBY_VERSION == "1.9.3"
spec.add_development_dependency "activesupport"
end
if RUBY_VERSION == "1.8.7"
s.add_development_dependency 'minitest', '3.2.0'
spec.add_development_dependency "activesupport", "2.3.12"
spec.add_development_dependency 'minitest', '3.2.0'
end
if RUBY_VERSION == "1.9.2"
spec.add_development_dependency "activesupport", "3.2.11"
end
spec.add_development_dependency "i18n"
end
+15
-17

@@ -11,32 +11,32 @@ require "date_diff/version"

start_date, end_date = end_date, start_date if start_date > end_date
start_date_month, start_date_day = start_date.month, start_date.day
end_date_month, end_date_day = end_date.month, end_date.day
day_difference = end_date_day - start_date_day
if (day_difference < 0)
if (day_difference < 0)
day_difference = nday[start_date_month-1] - start_date_day + end_date_day
end_date_month = end_date_month -1
end
if (end_date_month < 0)
if (end_date_month < 0)
end_date_month = end_date_month + 12
end_date.year = end_date.year -1
end
end
month_difference = end_date_month - start_date_month
if (month_difference < 0)
if (month_difference < 0)
month_difference = month_difference + 12
end_date.year = end_date.year -1
end
year_difference = end_date.year - start_date.year
difference_hash = { :year => year_difference, :month => month_difference, :day => day_difference }
difference_array = []
difference_hash.each do |key, value|
["year", "month", "day"].each do |key|
value = difference_hash[key.to_sym]
difference_array << value.to_s + " " + ((value > 1)? I18n.t(key.to_s.pluralize, :default => key.to_s.pluralize.to_s) : I18n.t(key.to_s, :default => key.to_s)).to_s if value > 0

@@ -46,5 +46,3 @@ end

difference_hash
end
end
module DateDiff
VERSION = "0.0.1"
VERSION = "0.0.2"
end