Module: Latias::Date::Formater

Defined in:
lib/latias/date/formater.rb

Instance Method Summary collapse

Instance Method Details

#buddhist_year(year) ⇒ Object



10
11
12
# File 'lib/latias/date/formater.rb', line 10

def buddhist_year(year)
  year + 543
end

#buddist_date_format(date, format: '%e %B %Y') ⇒ Object



4
5
6
7
8
# File 'lib/latias/date/formater.rb', line 4

def buddist_date_format(date, format: '%e %B %Y')
  format = format.gsub('%Y', buddhist_year(date.year).to_s)
  format = format.gsub('%y', (buddhist_year(date.year) % 100).to_s)
  I18n.l(date, format: format, locale: :th)
end