Fix date format

This commit is contained in:
BoHung Chiu 2020-05-07 09:56:48 +08:00
parent d8bb945fb5
commit 0606bda680
1 changed files with 3 additions and 1 deletions

View File

@ -77,7 +77,9 @@ class Experience
elsif t == "duration"
if !p.send('start_date').nil? or !p.send('end_date').nil?
date = (p.send('start_date').strftime('%Y.%m') rescue "")+' ~ '+(p.send('end_date').strftime('%Y.%m') rescue I18n.t('personal_experience.up_to_today'))
start_date = ((p.send('start_date').blank?) ? "" : p.send('start_date').strftime('%Y.%m')) rescue ""
end_date = ((p.send('end_date').blank? || p.send('end_date').to_s == "0000-01-01" ) ? I18n.t('personal_experience.up_to_today') : p.send('end_date').strftime('%Y.%m')) rescue I18n.t('personal_experience.up_to_today')
date = start_date+' ~ '+end_date
else
date = ""
end