Skip to content

Instantly share code, notes, and snippets.

@jvkumar

jvkumar/date.rb

Created Oct 9, 2012
Embed
What would you like to do?
date monkey patching
require 'date'
class Date
class << self
alias_method :original_parse, :parse
end
def self.parse(str='-4712-01-01', comp=true,start=ITALY)
if str == '0000-00-00 00:00:00'
str = '1970-01-01 00:00:00'
end
self.original_parse(str, comp, start)
end
end
puts Date.parse('0000-00-00 00:00:00')
@jvkumar

This comment has been minimized.

Copy link
Owner Author

@jvkumar jvkumar commented Oct 10, 2012

https://github.com/datamapper/dm-core/issues/184
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment