Guest User

Untitled

a guest
Jul 15th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. def time_interval(from_date, to_date)
  2. if to_date != nil
  3. if from_date.month < to_date.month
  4. result = "<span>#{from_date.day}</span>&nbsp;#{months_genitive[from_date.month]}&mdash;<span>#{to_date.day}</span>&nbsp;#{months_genitive[to_date.month]},&nbsp;#{week_days[from_date.wday]}&ndash;#{week_days[to_date.wday]}"
  5. elsif from_date.month >= to_date.month
  6. if from_date == to_date
  7. result = "<span>#{from_date.day}</span> #{months_genitive[from_date.month]},&nbsp;#{week_days[from_date.wday]}"
  8. else
  9. result = "<span>#{from_date.day}&mdash;#{to_date.day}</span> #{months_genitive[from_date.month]},&nbsp;#{week_days[from_date.wday]}&ndash;#{week_days[to_date.wday]}"
  10. end
  11. end
  12. else
  13. result = "<span>#{from_date.day}</span> #{months_genitive[from_date.month]},&nbsp;#{week_days[from_date.wday]}"
  14. end
  15.  
  16. return "#{result}"
  17. end
Add Comment
Please, Sign In to add comment