lib/validates_timeliness/formats.rb in validates_timeliness-2.3.1 vs lib/validates_timeliness/formats.rb in validates_timeliness-2.3.2
- old
+ new
@@ -207,10 +207,12 @@
if matches
values = processor.call(*matches[1..last])
values[0..2] = dummy_date_for_time_type if type == :time
return values
end
+ rescue
+ nil
end
# Delete formats of specified type. Error raised if format not found.
def remove_formats(type, *remove_formats)
remove_formats.each do |format|
@@ -253,9 +255,10 @@
def full_hour(hour, meridian)
hour = hour.to_i
return hour if meridian.nil?
if meridian.delete('.').downcase == 'am'
+ raise if hour == 0 || hour > 12
hour == 12 ? 0 : hour
else
hour == 12 ? hour : hour + 12
end
end