validates_timeliness 1.1.4 → 1.1.5

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.5 [2009-01-21]
2
+ - Fixed regex for 'yy' format token which wasn't greedy enough for date formats ending with year when a datetime string parsed as date with a 4 digit year
3
+
1
4
  = 1.1.4 [2009-01-13]
2
5
  - Make months names respect i18n in Formats
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.4"
8
+ GEM_VERSION = "1.1.5"
9
9
  AUTHOR = "Adam Meehan"
10
10
  EMAIL = "adam.meehan@gmail.com"
11
11
  HOMEPAGE = "http://github.com/adzap/validates_timeliness"
@@ -53,11 +53,10 @@ module ValidatesTimeliness
53
53
 
54
54
  def setup_for_rails
55
55
  major, minor = Rails::VERSION::MAJOR, Rails::VERSION::MINOR
56
- self.send("setup_for_rails_#{major}_#{minor}")
57
56
  self.default_timezone = ::ActiveRecord::Base.default_timezone
57
+ self.send("setup_for_rails_#{major}_#{minor}")
58
58
  rescue
59
- puts "Rails version #{Rails::VERSION::STRING} not explicitly supported by validates_timeliness plugin. You may encounter some problems."
60
- resume
59
+ puts "Rails version #{major}.#{minor}.x not explicitly supported by validates_timeliness plugin. You may encounter some problems."
61
60
  end
62
61
  end
63
62
  end
@@ -119,7 +119,7 @@ module ValidatesTimeliness
119
119
  def define_write_method_for_dates_and_times(attr_name, type, time_zone_aware)
120
120
  method_body = <<-EOV
121
121
  def #{attr_name}=(value)
122
- write_date_time_attribute('#{attr_name}', value, #{type.inspect}, #{time_zone_aware})
122
+ write_date_time_attribute('#{attr_name}', value, #{type.inspect}, #{time_zone_aware})
123
123
  end
124
124
  EOV
125
125
  evaluate_attribute_method attr_name, method_body, "#{attr_name}="
@@ -115,7 +115,7 @@ module ValidatesTimeliness
115
115
  { 'mm' => [ /m{2}/, '(\d{2})', :month ] },
116
116
  { 'm' => [ /(\A|[^ap])m{1}/, '(\d{1,2})', :month ] },
117
117
  { 'yyyy' => [ /y{4,}/, '(\d{4})', :year ] },
118
- { 'yy' => [ /y{2,}/, '(\d{2}|\d{4})', :year ] },
118
+ { 'yy' => [ /y{2,}/, '(\d{4}|\d{2})', :year ] },
119
119
  { 'hh' => [ /h{2,}/, '(\d{2})', :hour ] },
120
120
  { 'h' => [ /h{1}/, '(\d{1,2})', :hour ] },
121
121
  { 'nn' => [ /n{2,}/, '(\d{2})', :min ] },
@@ -157,11 +157,16 @@ describe ValidatesTimeliness::Formats do
157
157
  time_array = formats.parse('2000-02-01', :datetime, false)
158
158
  time_array.should == [2000,2,1,0,0,0,0]
159
159
  end
160
-
160
+
161
161
  it "should ignore time when extracting date and strict is false" do
162
162
  time_array = formats.parse('2000-02-01 12:12', :date, false)
163
163
  time_array.should == [2000,2,1,0,0,0,0]
164
164
  end
165
+
166
+ it "should ignore time when extracting date from format with trailing year and strict is false" do
167
+ time_array = formats.parse('01-02-2000 12:12', :date, false)
168
+ time_array.should == [2000,2,1,0,0,0,0]
169
+ end
165
170
 
166
171
  it "should ignore date when extracting time and strict is false" do
167
172
  time_array = formats.parse('2000-02-01 12:12', :time, false)
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.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Meehan
@@ -9,7 +9,7 @@ autorequire: validates_timeliness
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-13 00:00:00 +11:00
12
+ date: 2009-01-21 00:00:00 +11:00
13
13
  default_executable:
14
14
  dependencies: []
15
15