display comment date & time in user's time zone

This commit is contained in:
Sami Samhuri 2011-12-09 20:12:15 -08:00
parent 638e7797c6
commit 79710fa2c0
2 changed files with 3 additions and 2 deletions

View file

@ -86,6 +86,7 @@
$('#sd').click(showComments) $('#sd').click(showComments)
var showdown = new Showdown.converter() var showdown = new Showdown.converter()
, tzOffset = -new Date().getTimezoneOffset() * 60 * 1000
$('#comment-form').submit(function() { $('#comment-form').submit(function() {
var comment = $(this).serializeObject() var comment = $(this).serializeObject()
@ -100,7 +101,7 @@
document.getElementById('thoughts').focus() document.getElementById('thoughts').focus()
return false return false
} }
comment.timestamp = +comment.timestamp comment.timestamp = +comment.timestamp + tzOffset
var options = { method: 'POST' var options = { method: 'POST'
, uri: postCommentURL() , uri: postCommentURL()

View file

@ -43,7 +43,7 @@
<% } else { %> <% } else { %>
<%= name %> <%= name %>
<% } %> <% } %>
@ <%= strftime('%F %r', new Date(timestamp)) %> @ <%= strftime('%F %I:%M %p', new Date(timestamp)) %>
</p> </p>
<blockquote><%= html %></blockquote> <blockquote><%= html %></blockquote>
</div> </div>