Something extremely weird is going on with my Rails application. In one of my models, I have the attribute schedule
and it's configured as datetime
. In my view, I have a table that goes through each Post and displays its schedule as post.schedule
.
For example, I have one of the products set for 9:00 AM CST, as shown below:
2.5.0 :003 > Post.first.schedule.strftime("%l:%M %p")
Post Load (0.3ms) SELECT `posts`.* FROM `posts` ORDER BY `posts`.`id` ASC LIMIT 1
=> " 9:00 AM"
Here's what it looks like in my view.
<td width="15%"><%= post.schedule.strftime("%a, %B %d, %Y") %> @ <%= post.schedule.strftime("%l:%M %p") %></td>
In the actual HTML page though, it keeps flipping between 3:00 AM to 9:00 AM. Literally, I can refresh the page twice in 30 seconds and it will flip between the two.
Any idea what could possibly be causing this? It's obviously flipping between UTC and CST, but I'm not sure how to stop this from happening and only use CST.
If the Post's schedule is not changing, why is the time zone constantly flipping back and forth?