Fix date format bug.
This commit is contained in:
parent
f3ab02e1f7
commit
54b2e4698c
|
@ -174,11 +174,21 @@ class EventNews
|
|||
parse_format = self.date_parse_format
|
||||
if s.to_date == e.to_date
|
||||
parse_format_arr = parse_format.split(/(%d %a|%d) /)
|
||||
if parse_format_arr.count > 1
|
||||
parse_format_arr = parse_format_arr[0..-2].join(""), parse_format_arr[-1]
|
||||
end
|
||||
date_str = custom_strftime(s, parse_format_arr[0])
|
||||
s_time = s.strftime(parse_format_arr[1])
|
||||
e_time = e.strftime(parse_format_arr[1])
|
||||
s_time = s.strftime(parse_format_arr[1].to_s)
|
||||
e_time = e.strftime(parse_format_arr[1].to_s)
|
||||
if e_time.present?
|
||||
if s_time != e_time
|
||||
"#{date_str} #{s_time} ~ #{e_time}"
|
||||
else
|
||||
"#{date_str} #{s_time}"
|
||||
end
|
||||
else
|
||||
date_str
|
||||
end
|
||||
else
|
||||
custom_strftime(s, self.date_parse_format) + " ~ " + custom_strftime(e, self.date_parse_format)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue