Thanks Mikong, I tried what you suggested and found it was working
fine in the console, but not in the app itself. So I checked out the
controller code and found that the problem was I was using the helper
method Time.now.to_s(:db)
I thought that this was needed before saving dates to databases, but
it turns out that you just need Time.now and everything works fine.

Thanks so much for your help - it was much appreciated. The screencast
is very useful, particularly the part about letting users pick their
own time zone.

cheers,

DAZ

On Dec 23, 6:53 pm, mikong <[email protected]> wrote:
> I generated my own Task model with completed_on as timestamp. I used
> timestamp because created_at/updated_at were datetime and I thought
> that could be the problem. It still works though.
>
> I don't think it really matters if Time.now in console is -0800. As
> long as your timestamp/datetime objects have time zone information
> (like the -0800 in Time.now), it should be resolved properly. Setting
> the model field value to Time.now, and then displaying it using
> distance_of_time_in_words_to_now helper should be ok (as I've tested).
>
> As mentioned by Ryan Bates in the Time Zone screencast, as long as the
> dates are stored consistently as UTC in the DB, it should work.
> Perhaps you have old tasks data in your DB with completed_on not
> stored in UTC?
>
> You can also try checking the values of the following in your console
> (where @task is set to a Task you want to check, perhaps one that
> doesn't display the proper value):
>
> >> @task.completed_on
> >> @task.completed_on_before_type_cast
> >> Time.now
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to