adzap-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
data/Rakefile
CHANGED
data/lib/validates_timeliness.rb
CHANGED
@@ -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 #{
|
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
|
-
|
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{
|
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 ] },
|
data/spec/formats_spec.rb
CHANGED
@@ -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: adzap-validates_timeliness
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
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-
|
12
|
+
date: 2009-01-21 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|