Sha256: 6e3dd0f7db4b83f3e5031c5b4969d924f24c9d84b2c1e1a88f2a47aef8dd2714

Contents?: true

Size: 526 Bytes

Versions: 3

Compression:

Stored size: 526 Bytes

Contents

Date::DATE_FORMATS[:default] = '%d/%m/%Y'
Time::DATE_FORMATS[:default]= '%d/%m/%Y %H:%M:%S'


class Date
  class << self
    def _parse_with_us_format(date, *args)
      if date.nil?
        return ''
      end
      
      if date =~ %r{^(\d+)/(\d+)/(\d+)$}
        _parse_without_us_format("#{$3.length == 2 ? "20#{$3}" : $3}-#{$2}-#{$1}", *args)
      else
        _parse_without_us_format(date, *args)
      end
    end
    alias_method_chain :_parse, :us_format
  end
end

class NilClass
  
  def to_date
    ''
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
flexa_lib-0.5.2 lib/flexa_lib/date_extensions.rb
flexa_lib-0.5.1 lib/flexa_lib/date_extensions.rb
flexa_lib-0.5.0 lib/flexa_lib/date_extensions.rb