Skip to content

Instantly share code, notes, and snippets.

View xn's full-sized avatar

Christian Trosclair xn

View GitHub Profile
@xn
xn / gist:714891
Created November 25, 2010 04:16
home_run failing with subtraction using ActiveSupport and DateTime
irb(main):001:0> require 'active_support/core_ext'
=> true
irb(main):002:0> x = Date.new(2001)
=> Mon, 01 Jan 2001
irb(main):003:0> x - 1.second
=> 2000-12-31 23:59:59 -0500
irb(main):004:0> y = DateTime.new(2001)
=> Mon, 01 Jan 2001 00:00:00 +0000
irb(main):005:0> y - 1.second
TypeError: expected numeric or date