Sha256: 79824d624b69c1ca72d30471471e9acccf55b298999e1401344cbf55a1e34d4b

Contents?: true

Size: 565 Bytes

Versions: 16

Compression:

Stored size: 565 Bytes

Contents

require 'active_support'
require 'active_support/time'

module FeCoreExt::CoreExt
end

module FeCoreExt::CoreExt::Date
  def end_of_month?
    self == end_of_month
  end
end

module FeCoreExt::CoreExt::DateClassMethods
  def parse_as_future(string)
    date = parse(string)
    date > current ? date : date + 1.year
  end

  def parse_heisei(string)
    string.match('平成(\d+)年(\d+)月(\d+)日') {
      Date.new($1.to_i + 1988, $2.to_i, $3.to_i)
    }
  end
end

class Date
  include FeCoreExt::CoreExt::Date
  extend FeCoreExt::CoreExt::DateClassMethods
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
fe_core_ext-0.1.37 lib/fe_core_ext/core_ext/date.rb
fe_core_ext-0.1.36 lib/fe_core_ext/core_ext/date.rb
fe_core_ext-0.1.35 lib/fe_core_ext/core_ext/date.rb
fe_core_ext-0.1.34 lib/fe_core_ext/core_ext/date.rb
fe_core_ext-0.1.33 lib/fe_core_ext/core_ext/date.rb
fe_core_ext-0.1.32 lib/fe_core_ext/core_ext/date.rb
fe_core_ext-0.1.31 lib/fe_core_ext/core_ext/date.rb
fe_core_ext-0.1.30 lib/fe_core_ext/core_ext/date.rb
fe_core_ext-0.1.29 lib/fe_core_ext/core_ext/date.rb
fe_core_ext-0.1.28 lib/fe_core_ext/core_ext/date.rb
fe_core_ext-0.1.27 lib/fe_core_ext/core_ext/date.rb
fe_core_ext-0.1.26 lib/fe_core_ext/core_ext/date.rb
fe_core_ext-0.1.25 lib/fe_core_ext/core_ext/date.rb
fe_core_ext-0.1.24 lib/fe_core_ext/core_ext/date.rb
fe_core_ext-0.1.23 lib/fe_core_ext/core_ext/date.rb
fe_core_ext-0.1.22 lib/fe_core_ext/core_ext/date.rb