lib/timeliness/helpers.rb in timeliness-0.3.5 vs lib/timeliness/helpers.rb in timeliness-0.3.6
- old
+ new
@@ -20,10 +20,10 @@
end
year.to_i
end
def month_index(month)
- return Integer(month) rescue ArgumentError
+ return month.to_i if month.to_i > 0 || /0+/ =~ month
month.length > 3 ? month_names.index(month.capitalize) : abbr_month_names.index(month.capitalize)
end
def month_names
i18n_loaded? ? I18n.t('date.month_names') : Date::MONTHNAMES