Fix format bug.

This commit is contained in:
BoHung Chiu 2022-08-23 20:26:46 +08:00
parent 3850223d31
commit 8ba1baa045
1 changed files with 1 additions and 1 deletions

View File

@ -98,7 +98,7 @@ class WritingConference
if same_year && same_month
date = self.period_start_date.strftime(date_format.sub('%d', "%d-#{self.period_end_date.strftime('%d')}"))
elsif same_year
month_date_format = date_format.match(/(%m|%d)[\-\/\.]*(%m|%d)/)[0] rescue ''
month_date_format = date_format.match(/(%b|%m|%d)[\-\/\. ]*(%b|%m|%d)/)[0] rescue ''
date = self.period_start_date.strftime(date_format.sub(month_date_format, "#{month_date_format}-#{self.period_end_date.strftime(month_date_format)}"))
else
date = self.period_start_date.strftime(date_format) + ' ~ ' + self.period_end_date.strftime(date_format)