From 36db56c2556bb2f82c85b991cf29a9486c3625c0 Mon Sep 17 00:00:00 2001 From: Antoine WEBER Date: Tue, 22 Sep 2015 16:05:43 +0200 Subject: [PATCH] test et debug --- routes/channel.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/routes/channel.js b/routes/channel.js index 8110e36..5ebb6e6 100644 --- a/routes/channel.js +++ b/routes/channel.js @@ -14,8 +14,13 @@ router.get('/:id', function(req, res, next) { }; function formatDuree(time) { - var d = new Date(time); // js fonctionne en milisecondes - return addZero(d.getHours()) + "h "+ addZero(d.getMinutes()) + "m "+ addZero(d.getSeconds()) + "s "; + if(typeof time !== 'undefined' && time != "" && time > 0){ + var d = new Date(time); // js fonctionne en milisecondes + return addZero(d.getHours()-1) + "h "+ addZero(d.getMinutes()) + "m "+ addZero(d.getSeconds()) + "s "; + } + else { + return ""; + } } function humanFileSize(bytes, si) { @@ -43,7 +48,7 @@ router.get('/:id', function(req, res, next) { // stmt.run("Ipsum " + i); //} //stmt.finalize(); - + db.get("SELECT id, name, section_type as type" + " FROM library_sections WHERE id = ? ORDER BY name ASC",req.params.id, function(err, row) { channel_info = row;