safai 0.0.26 → 0.0.27
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/safai.rb +9 -4
- metadata +1 -1
data/lib/safai.rb
CHANGED
@@ -24,10 +24,15 @@ class Safai
|
|
24
24
|
content_for(:title) { page_title }
|
25
25
|
end
|
26
26
|
|
27
|
-
def smart_date(i)
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
def smart_date(i, mode="date")
|
28
|
+
if i.blank?
|
29
|
+
return ""
|
30
|
+
elsif (i.class.to_s == "Time" or i.class.to_s == "ActiveSupport::TimeWithZone") and mode == "time"
|
31
|
+
return i.year == Time.now.year ? i.strftime("%d-%b %H:%M") : i.strftime("%d-%b-%Y %H:%M")
|
32
|
+
else
|
33
|
+
return i.year == Time.now.year ? i.strftime("%d-%b") : i.strftime("%d-%b-%Y")
|
34
|
+
end
|
35
|
+
end
|
31
36
|
|
32
37
|
def smart_due_date(i)
|
33
38
|
if i == nil
|