3

"The difference of .current and .now is that .now uses the server's timezone, while .current uses what the Rails environment is set to (Time.zone), if not set, then .current will act the same as .now."

When I do 10.minutes.ago, is Rails using Time.current or Time.now?

Community
  • 1
  • 1
Fellow Stranger
  • 32,129
  • 35
  • 168
  • 232

2 Answers2

5

Time.current (ActiveSupport 5.2.0)

kares
  • 7,076
  • 1
  • 28
  • 38
5

If you wish to use Time.now for 10.minutes.ago or 10.minutes.from_now, you can pass Time.now as parameter into ago or from_now method

ex: 10.minutes.ago(Time.now) or 10.minutes.from_now(Time.now)

Derek Fan
  • 817
  • 11
  • 10