fixed fallback for out of range dates which Rails does not handle automatically

aliased timeliness_date_time_parse to parse_date_time for nicer interface
This commit is contained in:
Adam Meehan
2008-07-20 09:06:39 +10:00
parent 70ba75a4ae
commit 9cf994564e
4 changed files with 11 additions and 11 deletions

View File

@@ -186,6 +186,7 @@ describe ValidatesTimeliness::Formats do
after do
formats.time_formats << 'h.nn_ampm'
# reload class instead
end
end
@@ -223,6 +224,7 @@ describe ValidatesTimeliness::Formats do
after do
formats.time_formats.delete("h o'clock")
formats.time_formats.delete("ss:hh:nn")
# reload class instead
end
end
@@ -231,13 +233,12 @@ describe ValidatesTimeliness::Formats do
time_array = formats.extract_date_time_values('01/02/2000', :date)
time_array.should == [2000, 1, 2,nil,nil,nil,nil]
formats.remove_us_formats
puts formats.datetime_formats.inspect
time_array = formats.extract_date_time_values('01/02/2000', :date)
time_array.should == [2000, 2, 1,nil,nil,nil,nil]
end
after do
# reload class
end
end

View File

@@ -53,12 +53,10 @@ describe ValidatesTimeliness::Validations do
@person.should be_valid
end
# What is going on? No fall back.
it "should be valid with values before out of Time range" do
@person.birth_date_and_time = "1890-01-31 12:12:12"
@person.birth_date = "1890-01-31"
@person.birth_time = "23:59:59"
puts @person.errors.inspect
@person.should be_valid
end