don't allow 0 or > 12 for meridian am hour

This commit is contained in:
Adam Meehan
2010-09-17 14:52:39 +10:00
parent 0ea0201051
commit d6ddae9977
2 changed files with 10 additions and 0 deletions

View File

@@ -102,6 +102,13 @@ describe ValidatesTimeliness::Formats do
time_array.should == [2000,1,1,12,13,14,0]
end
it "should return nil if time hour is out of range for AM meridian" do
time_array = formats.parse('13:14 am', :time, :strict => true)
time_array.should == nil
time_array = formats.parse('00:14 am', :time, :strict => true)
time_array.should == nil
end
it "should return date array from time string" do
time_array = formats.parse('2000-02-01', :date, :strict => true)
time_array.should == [2000,2,1,0,0,0,0]