From deb1bcf70b145e3adf2a0290cd9e849c05d81b85 Mon Sep 17 00:00:00 2001 From: "youri.apell@gmail.com" Date: Fri, 4 Nov 2022 14:14:39 +0100 Subject: [PATCH] Add 0 before the minutes if they are smaller than 10 --- dashboard_static/js/code.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dashboard_static/js/code.js b/dashboard_static/js/code.js index 3dcf2c8..ea7eb9c 100644 --- a/dashboard_static/js/code.js +++ b/dashboard_static/js/code.js @@ -26,6 +26,13 @@ function showFeeds() { function tweetCell(tweet) { const date = new Date(tweet.created_at); + const minutes = date.getMinutes(); + + if (minutes < 10) { + minutes = "0" + minutes + } + + var cell = document.createElement("div"); cell.innerHTML = `
@@ -36,9 +43,9 @@ function tweetCell(tweet) { ${tweet.user.name} @${tweet.user.screen_name}
- ${date.getHours()}:${date.getMinutes()} + ${date.getHours()}:${minutes} - ${tweet.text} + ${tweet.text}
favorite