Permalink
Browse files

Fixed timezones to be Chicago time. Todo - locale aware away of doing…

… this would be an awesome challenge
  • Loading branch information...
deanius committed Jan 23, 2011
1 parent ad83da5 commit 1b888d1bfe7c107b3af84ae48e43aaf11b7cc0ea
Showing with 6 additions and 3 deletions.
  1. +4 −1 app/models/chat.rb
  2. +1 −1 app/models/move.rb
  3. +1 −1 app/views/chats/_show.html.erb
View
@@ -15,11 +15,14 @@ def board_num
return @board_num+1
end
+ def created_at_local
+ created_at.in_time_zone( 'America/Chicago' )
+ end
def to_json
{
:id => id,
:player => player.name,
- :time => created_at.strftime("%a %H:%M"),
+ :time => created_at_local.strftime("%a %H:%M"),
:text => text,
:board_num => board_num
}.to_json
View
@@ -92,7 +92,7 @@ def validate
end
def friendly_time
- self.created_at && self.created_at.strftime("%a %H:%M")
+ self.created_at && self.created_at.in_time_zone( 'America/Chicago' ).strftime("%a %H:%M")
end
def time_since_last_move
@@ -1,5 +1,5 @@
<% chats.each do |chat| %>
- <div class='chat_line' onclick="view.display_board(<%= chat.board_num %>)"><b title="<%= chat.created_at.strftime("%a %H:%M") %>"><%= chat.player.name %>: </b><%= chat.text %></div>
+ <div class='chat_line' onclick="view.display_board(<%= chat.board_num %>)"><b title="<%= chat.created_at_local.strftime("%a %H:%M") %>"><%= chat.player.name %>: </b><%= chat.text %></div>
<% end %>
<script language="javascript">

0 comments on commit 1b888d1

Please sign in to comment.