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

This commit is contained in:
Adam Meehan
2010-09-17 14:36:21 +10:00
parent a78700d192
commit 4fa8dfac72
2 changed files with 10 additions and 0 deletions

View File

@@ -102,6 +102,13 @@ describe ValidatesTimeliness::Parser 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]