6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/mack-localization/format_engine/df_engines/base.rb', line 6
def format(time = Time.now, type = :long)
day = time.day
day_of_week = time.wday
day_of_month = time.mday
month = time.month
year = time.year
raise Mack::Localization::Errors::InvalidArgument.new(type) if date_format_template(type).nil?
template = date_format_template(type).dup
template.gsub!("mm", "%02d" % month.to_s)
template.gsub!("MM", months(type)[month-1])
template.gsub!("dd", "%02d" % day.to_s)
template.gsub!("yyyy", year.to_s)
template.gsub!("DD", days_of_week(type)[day_of_week-1])
return template
end
|