Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def time_interval(from_date, to_date)
- if to_date != nil
- if from_date.month < to_date.month
- result = "<span>#{from_date.day}</span> #{months_genitive[from_date.month]}—<span>#{to_date.day}</span> #{months_genitive[to_date.month]}, #{week_days[from_date.wday]}–#{week_days[to_date.wday]}"
- elsif from_date.month >= to_date.month
- if from_date == to_date
- result = "<span>#{from_date.day}</span> #{months_genitive[from_date.month]}, #{week_days[from_date.wday]}"
- else
- result = "<span>#{from_date.day}—#{to_date.day}</span> #{months_genitive[from_date.month]}, #{week_days[from_date.wday]}–#{week_days[to_date.wday]}"
- end
- end
- else
- result = "<span>#{from_date.day}</span> #{months_genitive[from_date.month]}, #{week_days[from_date.wday]}"
- end
- return "#{result}"
- end
Add Comment
Please, Sign In to add comment