Merge pull request #167 from gopesht/conference_date_helper
Modified date helper
This commit is contained in:
commit
af8daa3b1a
1 changed files with 15 additions and 12 deletions
|
|
@ -13,22 +13,25 @@ module HomeHelper
|
||||||
# All other cases
|
# All other cases
|
||||||
# * %B %d, %Y - %B %d, %Y (December 30, 2013 - January 02, 2014)
|
# * %B %d, %Y - %B %d, %Y (December 30, 2013 - January 02, 2014)
|
||||||
def conference_date_string(conf)
|
def conference_date_string(conf)
|
||||||
startstr = "Unknown - "
|
date_string(conf.start_date, conf.end_date)
|
||||||
endstr = "Unknown"
|
end
|
||||||
# When the conference in the same motn
|
|
||||||
if conf.start_date.month == conf.end_date.month and conf.start_date.year == conf.end_date.year
|
def date_string(start_date, end_date)
|
||||||
startstr = conf.start_date.strftime("%B %d - ")
|
startstr = 'Unknown - '
|
||||||
endstr = conf.end_date.strftime("%d, %Y")
|
endstr = 'Unknown'
|
||||||
elsif conf.start_date.month != conf.end_date.month && conf.start_date.year == conf.end_date.year
|
# When the conference in the same month
|
||||||
startstr = conf.start_date.strftime("%B %d - ")
|
if start_date.month == end_date.month && start_date.year == end_date.year
|
||||||
endstr = conf.end_date.strftime("%B %d, %Y")
|
startstr = start_date.strftime('%B %d - ')
|
||||||
|
endstr = end_date.strftime('%d, %Y')
|
||||||
|
elsif start_date.month != end_date.month && start_date.year == end_date.year
|
||||||
|
startstr = start_date.strftime('%B %d - ')
|
||||||
|
endstr = end_date.strftime('%B %d, %Y')
|
||||||
else
|
else
|
||||||
startstr = conf.start_date.strftime("%B %d, %Y - ")
|
startstr = start_date.strftime('%B %d, %Y - ')
|
||||||
endstr = conf.end_date.strftime("%B %d, %Y")
|
endstr = end_date.strftime('%B %d, %Y')
|
||||||
end
|
end
|
||||||
|
|
||||||
result = startstr + endstr
|
result = startstr + endstr
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue