Method: FeCoreExt::CoreExt::DateClassMethods#parse_heisei

Defined in:
lib/fe_core_ext/core_ext/date.rb

#parse_heisei(string) ⇒ Object



46
47
48
49
50
# File 'lib/fe_core_ext/core_ext/date.rb', line 46

def parse_heisei(string)
  string.match('平成(\d+)年(\d+)月(\d+)日') do
    Date.new(::Regexp.last_match(1).to_i + 1988, ::Regexp.last_match(2).to_i, ::Regexp.last_match(3).to_i)
  end
end