13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/pyk/date_helpers.rb', line 13
def smart_due_date(i)
if i == nil
return ""
elsif i.class.to_s == "Time" or i.class.to_s == "ActiveSupport::TimeWithZone"
i = i.to_date
end
if Date.today == i
return "<span style=\"background-color:#F7FAB9;padding:0px 2px 0px 2px;\">Today</span>"
elsif i - Date.today == 1
return "<span style=\"background-color:#F7FAB9;padding:0px 2px 0px 2px;\">Tomorrow</span>"
elsif Date.today - i > 0.9
return "<span style=\"background-color:#FFC7C7;padding:0px 2px 0px 2px;\">" + smart_date(i) + "</span>"
elsif Date.today - i < 1
return "<span style=\"background-color:#D2FFCC;padding:0px 2px 0px 2px;\">" + smart_date(i) + "</span>"
end
return smart_date(i, "date")
end
|