Time.local and February Dates

(Ben Gribaudo) #1

Howdy Folks,

In irb (1.8.2), executing Time.local(2005,2,31) results in Thu Mar 03 00:00:00 CST 2005 being returned. Ruby figured out that February 2005 ended on the 28th and that the 31st is 3 days past the 28th, so it rolled the date ahead to March 3rd.

Is this intended behavior or a bug?

I would expect Time to raise ArgumentError. This is what occurs when Time.local(2005,3,32) is run.

Thank you,
Ben Gribaudo