From 7323b01e42d573c12818f48e4b00ed8ff7736565 Mon Sep 17 00:00:00 2001 From: Bryson Steck Date: Tue, 27 Dec 2022 19:59:35 -0700 Subject: added contact page, blog list, redid homepage --- static/time.js | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'static/time.js') diff --git a/static/time.js b/static/time.js index 3e5650d..ac093b1 100644 --- a/static/time.js +++ b/static/time.js @@ -1,27 +1,28 @@ +var colon = ":"; function updateTime(){ var date = new Date() var hours = date.getHours() var minutes = date.getMinutes() - var seconds = date.getSeconds() - var old_hours = hours; - if (hours > 12) { + if (hours > 11) + var tod = " pm"; + else + var tod = " am"; + + if (hours > 12) hours = hours - 12 - } else if (hours == 0) { + else if (hours == 0) hours = 12 - } - if (minutes < 10) { + if (minutes < 10) minutes = "0" + minutes - } - var t_str = hours + ":" + minutes; - if (old_hours > 11) { - t_str += " pm"; - } else { - t_str += " am"; - } + if (colon === ":") + colon = " "; + else if (colon === " ") + colon = ":"; + var t_str = hours + colon + minutes + tod; document.getElementById('time').innerHTML = t_str; } -setInterval(updateTime, 1); +setInterval(updateTime, 500); -- cgit v1.2.3