From 3a6106aac43a2bad52822071657de357ad84fd8b Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Sat, 19 Jul 2014 00:41:23 +0200 Subject: [PATCH] Convert unix timestamp to localized date string on manage room page --- public/js/vroom.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/public/js/vroom.js b/public/js/vroom.js index b009224..f680992 100644 --- a/public/js/vroom.js +++ b/public/js/vroom.js @@ -224,6 +224,12 @@ function getTime(){ return hours + ':' + minutes + ':' + seconds; } +// Convert a timestamp to readable date +function timeStamp2Date(sec){ + var d = new Date(sec*1000); + return d.toLocaleString(); +} + // Temporarily suspend a button, prevent abuse function suspendButton(el){ $(el).attr('disabled', true); @@ -302,6 +308,14 @@ function initIndex(){ }); } +// Used on the management page +function initManage(){ + // Replace timestamps with a readable date + $('.timeStamp').each(function(){ + $(this).html(timeStamp2Date(parseInt($(this).html()))); + }); +} + // This is the main function called when you join a room function initVroom(room) {