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 CHANGED
@@ -1,3 +1,6 @@
1
+ = 1.1.4 [2009-01-13]
2
+ - Make months names respect i18n in Formats
3
+
1
4
  = 1.1.3 [2009-01-13]
2
5
  - Fixed bug where time and date attributes still being parsed on read using Rails default parser [reported by Brad (pvjq)]
3
6
 
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'date'
5
5
  require 'spec/rake/spectask'
6
6
 
7
7
  GEM = "validates_timeliness"
8
- GEM_VERSION = "1.1.3"
8
+ GEM_VERSION = "1.1.4"
9
9
  AUTHOR = "Adam Meehan"
10
10
  EMAIL = "adam.meehan@gmail.com"
11
11
  HOMEPAGE = "http://github.com/adzap/validates_timeliness"
data/TODO CHANGED
@@ -1,5 +1,4 @@
1
1
  - :format option
2
2
  - :with_date and :with_time options
3
3
  - valid formats could come from locale file
4
- - formats to use month and day names from i18n
5
4
  - add replace_formats instead add_formats :before
@@ -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
- Date::ABBR_MONTHNAMES.index(month.capitalize) || Date::MONTHNAMES.index(month.capitalize)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validates_timeliness
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Meehan