Yeah that sounds pretty nasty.  To get around all this, I simply
changed my timeline endpoints to start at 30 days ago and end at
strictly less than today.midnight.  That way I don't include today's
numbers which could possibly be wrong because of timezone
differences.  Thanks Matt.


On Sep 4, 12:56 pm, Matt Jones <al2o...@gmail.com> wrote:
> I don't think this is going to work - you're grouping by the date in
> the DB, where they are all UTC. The dates that come back don't have
> times, so there isn't any way to convert them. (eg, 2009-09-03
> 02:39:22 UTC -> 2009-09-02 CDT, but 2009-09-03 2009-09-03 12:39:22 UTC
> -> 2009-09-03 CDT)
>
> The only way around it would be to add the offset back in on the SQL
> side before converting to a date; how you manage that will be based on
> which DB you're using. Note that you'll still have a mess on your
> hands, as the two months where DST changes won't have a consistent
> offset...
>
> --Matt Jones
>
> On Sep 3, 9:39 pm, JL Smith <autige...@gmail.com> wrote:
>
> > Yeah, I tried that in my example that I posted but the results aren't
> > then converted back to the users timezone.  So if a Product is sitting
> > in the database with created_at = 2009-09-03 02:39:22 UTC (which is
> > 2009-09-02 21:39:22 CDT), it won't come back converted to CDT.
>
> > On Sep 3, 11:54 am, Matt Jones <al2o...@gmail.com> wrote:
>
> > > This looks like an instance of this bug:
>
> > >https://rails.lighthouseapp.com/projects/8994/tickets/2946
>
> > > The quick way to fix it in this case is to convert the incoming
> > > datetime objects to UTC in timeline_created_products.
>
> > > --Matt Jones
>
> > > On Sep 2, 10:23 pm, JL Smith <autige...@gmail.com> wrote:
>
> > > > I'm having some trouble getting activerecord to adhere to my timezone
> > > > settings when finding objects based on its created_at field.  I
> > > > understand that datetime fields are stored in UTC but it doesn't
> > > > convert the datetimes when it performs the lookup.  I basically
> > > > followed Railscasts #106 and I'm using Authlogic for authentication.
> > > > Thanks for any help.
>
> > > >http://gist.github.com/180080
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to