Time.local and February Dates

B

Ben Gribaudo

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,176
Messages
2,570,950
Members
47,503
Latest member
supremedee

Latest Threads

Top