I’m trying to use the ActiveSupport Time extension but running into a
bit of trouble with the time zone.
I’d like to test if a user record has expired using the Time .ago
method, such as:
return true if self.activated < 1.day.ago
Unfortunately I can’t seem to use the .ago method in the comparison
because it’s using UTC time, whereas Time.now has my current time zone
Loading development environment (Rails 2.3.2)
=> Thu Jul 30 12:16:30 -0700 2009
=> Thu, 30 Jul 2009 18:16:34 UTC +00:00
I can get around this by using something like “Time.now + 1.day” but
I’m interested to know what I’m doing wrong with the .ago method.
Maybe there’s some sort of time zone setting that I’ve missed?