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