safai 0.0.26 → 0.0.27

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/safai.rb +9 -4
  2. 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
- return "" if i.blank?
29
- i.year == Time.now.year ? i.strftime("%d-%b") : i.strftime("%d-%b-%Y")
30
- end
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: safai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.26
4
+ version: 0.0.27
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: