From 79710fa2c04513719ba31fb7cfb1abe4ae6c2781 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Fri, 9 Dec 2011 20:12:15 -0800 Subject: [PATCH] display comment date & time in user's time zone --- assets/js/blog.js | 3 ++- templates/blog/post.html | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/assets/js/blog.js b/assets/js/blog.js index 47b1429..92bf15b 100644 --- a/assets/js/blog.js +++ b/assets/js/blog.js @@ -86,6 +86,7 @@ $('#sd').click(showComments) var showdown = new Showdown.converter() + , tzOffset = -new Date().getTimezoneOffset() * 60 * 1000 $('#comment-form').submit(function() { var comment = $(this).serializeObject() @@ -100,7 +101,7 @@ document.getElementById('thoughts').focus() return false } - comment.timestamp = +comment.timestamp + comment.timestamp = +comment.timestamp + tzOffset var options = { method: 'POST' , uri: postCommentURL() diff --git a/templates/blog/post.html b/templates/blog/post.html index 8e8ae58..ea2a480 100644 --- a/templates/blog/post.html +++ b/templates/blog/post.html @@ -43,7 +43,7 @@ <% } else { %> <%= name %> <% } %> - @ <%= strftime('%F %r', new Date(timestamp)) %> + @ <%= strftime('%F %I:%M %p', new Date(timestamp)) %>

<%= html %>