mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
Merge pull request #3909 from humzashah/reduced-time-operation
reused value of `Time.now` in a method
This commit is contained in:
commit
6577f3c1ed
1 changed files with 6 additions and 2 deletions
|
@ -1,8 +1,12 @@
|
||||||
module AgeWords
|
module AgeWords
|
||||||
|
|
||||||
def self.age_words(secs)
|
def self.age_words(secs)
|
||||||
return "—" if secs.blank?
|
if secs.blank?
|
||||||
return FreedomPatches::Rails4.distance_of_time_in_words(Time.now, Time.now + secs)
|
"—"
|
||||||
|
else
|
||||||
|
now = Time.now
|
||||||
|
FreedomPatches::Rails4.distance_of_time_in_words(now, now + secs)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue