mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-22 22:06:45 +00:00
fix parsing of datetimes with timezone (thanks sigi)
This commit is contained in:
parent
341a481231
commit
6265b2d804
@ -13,7 +13,7 @@ module ValidatesTimeliness
|
||||
if type == :date
|
||||
Date.new(*time_array[0..2]) rescue nil
|
||||
else
|
||||
make_time(time_array[0..7])
|
||||
make_time(time_array[0..6])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -8,6 +8,10 @@ describe ValidatesTimeliness::Parser do
|
||||
parse("2000-01-01 12:13:14", :datetime).should be_kind_of(Time)
|
||||
end
|
||||
|
||||
it "should return Time object for ISO 8601 string with time zone" do
|
||||
parse("2000-01-01T12:23:42+09:00", :datetime).should be_kind_of(Time)
|
||||
end
|
||||
|
||||
it "should return nil for time string with invalid date part" do
|
||||
parse("2000-02-30 12:13:14", :datetime).should be_nil
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user