From 7d4fd5b14f1182781db49a96ec1050af02d61083 Mon Sep 17 00:00:00 2001 From: Keegan McAllister Date: Wed, 12 Sep 2012 17:07:13 -0400 Subject: [PATCH] Zero-pad hour and minute (imported from commit 404600ce3cb2233acb1b2e69cdd87c64604d9826) --- zephyr/static/js/zephyr.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zephyr/static/js/zephyr.js b/zephyr/static/js/zephyr.js index 06c7832550..063db644f5 100644 --- a/zephyr/static/js/zephyr.js +++ b/zephyr/static/js/zephyr.js @@ -484,7 +484,9 @@ function add_message(index, zephyr) { zephyr.html_content = newline2br(zephyr.content); var time = new Date(zephyr.timestamp * 1000); - zephyr.timestr = time.getHours() + ':' + time.getMinutes(); + var two_digits = function (x) { return ('0' + x).slice(-2); } + zephyr.timestr = two_digits(time.getHours()) + + ':' + two_digits(time.getMinutes()); var new_tr = $('').attr('id', zephyr.id).addClass('zephyr_row'); $('#table').append(new_tr);