mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-04-30 07:53:57 -04: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…
Add table
Add a link
Reference in a new issue