time_ago_in_words is off by a day

Maybe someone can help me; I'm sure I'm just missing something silly. I have a Task model that has a due_date. In my migration it's set to a date:

t.date :due_date

I want to display both the actual date and a friendly format in the application, so in my view I have:

<p><%= time_ago_in_words(@task.due_date) %> (<%= @task.due_date.to_s(:long) %>)</p>

I have a sample task that has a due date set to October 12th, and @task.due_date.to_s(:long) confirms this. However, time_ago_in_words says that it's "1 day", when today is the 10th and it should be 2 days. In fact, I brought up a console and typed in 1.day.from_now, and sure enough it says that tomorrow is Sunday the 12th, instead of Saturday the 11th.

What am I missing? Should I be using a datetime instead (presumably it has something to do with the accuracy), even though I don't care about the time, only the actual date?

If it matters at all, I am using Postgres as my database.

Thanks for any help.

- Wayne

Look at your 1.day.from_now and see if it's like this:

Sun, 12 Oct 2008 02:45:42 UTC +00:00

If you also have the "UTC +00:00", it means that you timezone is the GMT (and I think that it isn't your real timezone). For example, my timezone is 3 hours after the GMT, so the right timezone would be something like this:

Sat Oct 11 23:48:41 -0300 2008

At your environment.rb file, look for something like this:

config.time_zone = 'UTC'

And change it to your timezone.

Yep, that was it. I knew it was something easy that I just overlooked.

Thanks a lot!