Created
August 15, 2014 23:30
-
-
Save ColinDKelley/1ceae2c447bac4dbac66 to your computer and use it in GitHub Desktop.
Fig leaf to intercept parse with American date formats like 03/04/05
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ParseFigLeaf | |
def parse(*args) | |
arg0 = args.first | |
arg0.is_a?(String) && arg0 =~ /\A\d\d[-\/]\d\d[-\/]\d\d/ and raise "Ambiguous parse format in #{arg0.inspect}" | |
super | |
end | |
end | |
class << Date | |
prepend ParseFigLeaf | |
end | |
class << Time | |
prepend ParseFigLeaf | |
end | |
class ActiveSupport::TimeZone | |
prepend ParseFigLeaf | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment