Zero-pad hour and minute

(imported from commit 404600ce3cb2233acb1b2e69cdd87c64604d9826)
This commit is contained in:
Keegan McAllister 2012-09-12 17:07:13 -04:00
parent d6d4bcd192
commit 7d4fd5b14f
1 changed files with 3 additions and 1 deletions

View File

@ -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 = $('<tr />').attr('id', zephyr.id).addClass('zephyr_row');
$('#table').append(new_tr);