Closed damien closed 10 years ago
These are shortcut equivalents to the zoned full version.
http://api.rubyonrails.org/v3.2.14/classes/Time.html#method-c-current
On 04/12/2013, at 4:47 PM, Damien Wilson notifications@github.com wrote:
The (restriction shorthand)[https://github.com/adzap/validates_timeliness/blob/master/lib/validates_timeliness.rb#L38-L41] seems to be referencing Time.now and Date.today. As far as I'm aware, this is not the correct way to reference localized time within rails; more specifically I don't believe these methods will pick up changes to Time.zone.
Time.zone.today and Time.zone.now will respect changes to Time.zone within rails. I'd be happy to submit a pull request with tests for these changes, would there be any objections to getting this into the gem?
— Reply to this email directly or view it on GitHub.
@adzap Consider me enlightened, these things I did not know! Sorry for taking up your time with a non-issue. :)
The restriction shorthand seems to be referencing
Time.now
andDate.today
. As far as I'm aware, this is not the correct way to reference localized time within rails; more specifically I don't believe these methods will pick up changes toTime.zone
.Time.zone.today
andTime.zone.now
will respect changes toTime.zone
within rails. I'd be happy to submit a pull request with tests for these changes, would there be any objections to getting this into the gem?