Sha256: 7c4b2f0c17de40e9b782b747301a32f4cf71b8fdc2c6abcdbd7a2956ee150e1d
Contents?: true
Size: 633 Bytes
Versions: 30
Compression:
Stored size: 633 Bytes
Contents
# --- Fix Chronic - can't parse '12th Jan' --- # begin require 'chronic' module Chronic class << self def parse_with_hobo_fix(s, *options) if s =~ /^\s*\d+\s*(st|nd|rd|th)\s+[a-zA-Z]+(\s+\d+)?\s*$/ s = s.sub(/\s*\d+(st|nd|rd|th)/) {|s| s[0..-3]} end # Chronic can't parse '1/1/2008 1:00' or '1/1/2008 1:00 PM', # so convert them to '1/1/2008 @ 1:00' and '1/1/2008 @ 1:00 PM' s = s.sub(/^\s*(\d+\/\d+\/\d+)\s+(\d+:\d+.*)/, '\1 @ \2') parse_without_hobo_fix(s, *options) end alias_method_chain :parse, :hobo_fix end end rescue LoadError; end
Version data entries
30 entries across 30 versions & 1 rubygems