I find the whole timezone thing confusing right now :-) So you are probably
right in that the patch was wrong.
I'm also not convinced yet about your patch though. In my application.rb I
have
- a setting for the timezone that is used to store dates in the
database (I use UTC).
- Since the upgrade to rails 2.1 (?) there is a new setting for the
timezone where your server is at. (I use 'Amsterdam')
- And we have the timezone setting in the preferences. (I use UTC +1)
Assuming dates in the database are in UTC shouldn't
find(:all, :conditions => ['show_from <= ?', Time.now.utc ]).collect { |t|
t.activate! }
be correct? Or is activerecord doing timezone conversions in the :conditions
clause too?
You're suggesting:
find(:all, :conditions => ['show_from <= ?', proxy_owner.date ]).collect {
|t| t.activate! }
proxy_owner.date uses Time.now.in_time_zone(prefs.time_zone).to_date
So it uses the timezone setting from Tracks' preferences. If activerecord is
_not_ doing timezone conversion in the :conditions, it compares UTC with the
users pref, right? Or am I missing something?
Everything probably changes if a user changes the default
config.active_record.default_timezone from UTC to something else. I think
that in that case using Time.now.utc goes wrong.
Isn't the best route to use
Time.now.in_time_zone(config.active_record.default_timezone) or something
like that? Any timezone wizards here :-)
Reinier
Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Namens Eric Allen
Verzonden: zondag 7 september 2008 4:56
Aan: [email protected]
Onderwerp: [Tracks-discuss] ticket 747 and timezone issue
I believe the fix
<http://github.com/bsag/tracks/commit/4ac09ed3ae391672f4077c0991b0bb8fc64247
56> for ticket 747 <http://dev.rousette.org.uk/ticket/747> is incorrect.
It may fix for people who are ahead of UTC, but somebody like me who lives
behind UTC (in the US) will see todos activate from the tickler before they
should. I believe the correct fix is proxy_owner.date, not Time.now.utc.
Attached is the commit I would push to master if I were sure it didn't break
other stuff. It has fixed my problem (which I'm not sure I ever filed a bug
for). Comments?
_______________________________________________
Tracks-discuss mailing list
[email protected]
http://lists.rousette.org.uk/mailman/listinfo/tracks-discuss