Sha256: 63a194a3189700869f4d35f2cd1e47836369bbf5a18406a95196590ca9f979df

Contents?: true

Size: 418 Bytes

Versions: 3

Compression:

Stored size: 418 Bytes

Contents

require 'active_support'
require 'active_support/time'

module FeCoreExt::CoreExt
end

module FeCoreExt::CoreExt::Date
  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
  extend FeCoreExt::CoreExt::Date
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fe_core_ext-0.1.21 lib/fe_core_ext/core_ext/date.rb
fe_core_ext-0.1.20 lib/fe_core_ext/core_ext/date.rb
fe_core_ext-0.1.19 lib/fe_core_ext/core_ext/date.rb