From 0606bda680573572477cbb0aaf543780e7ed5926 Mon Sep 17 00:00:00 2001 From: bohung Date: Thu, 7 May 2020 09:56:48 +0800 Subject: [PATCH] Fix date format --- app/models/experience.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/experience.rb b/app/models/experience.rb index 0e7b775..e47bc24 100644 --- a/app/models/experience.rb +++ b/app/models/experience.rb @@ -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