Mike Mike - 3 months ago 16
Ruby Question

Rails 3/Ruby 1.9.2 Date.tomorrow not correct

Using Ruby 1.9.2 and Rail 3 on Mac Snow leopard

ruby-1.9.2-p290 :001 > Date.today
=> Sun, 25 Sep 2011
ruby-1.9.2-p290 :002 > Date.tomorrow
=> Tue, 27 Sep 2011


Is there maybe something wrong with the ruby date class or is this something to do with the way i installed ruby?

Edit:

ruby-1.9.2-p290 :039 > Date.current
=> Mon, 26 Sep 2011
ruby-1.9.2-p290 :040 > DateTime.now
=> Sun, 25 Sep 2011 20:47:01 -0500


Ok so the rails Date class seems a little buggy. The DateTime class appears to work fine though. Thanks derp and Adam

Answer

I am also observing this. You can try DateTime.now.tomorrow.to_date.