adzap-validates_timeliness 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/Rakefile +1 -1
- data/TODO +0 -1
- data/lib/validates_timeliness/formats.rb +12 -2
- metadata +1 -1
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
data/TODO
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
1
3
|
module ValidatesTimeliness
|
2
4
|
|
3
5
|
# A date and time format regular expression generator. Allows you to
|
@@ -297,9 +299,17 @@ module ValidatesTimeliness
|
|
297
299
|
|
298
300
|
def month_index(month)
|
299
301
|
return month.to_i if month.to_i.nonzero?
|
300
|
-
|
302
|
+
abbr_month_names.index(month.capitalize) || month_names.index(month.capitalize)
|
301
303
|
end
|
302
|
-
|
304
|
+
|
305
|
+
def month_names
|
306
|
+
defined?(I18n) ? I18n.t('date.month_names') : Date::MONTHNAMES
|
307
|
+
end
|
308
|
+
|
309
|
+
def abbr_month_names
|
310
|
+
defined?(I18n) ? I18n.t('date.abbr_month_names') : Date::ABBR_MONTHNAMES
|
311
|
+
end
|
312
|
+
|
303
313
|
def microseconds(usec)
|
304
314
|
(".#{usec}".to_f * 1_000_000).to_i
|
305
315
|
end
|