From eabbe53c13e5fcf45a50b2163c871e6f9d55f991 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Wed, 26 Feb 2014 13:11:45 -0800 Subject: Add option for 12-hour time. --- tempo.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tempo.js') diff --git a/tempo.js b/tempo.js index 6fed6ad..0d90f5f 100644 --- a/tempo.js +++ b/tempo.js @@ -13,6 +13,8 @@ function padTime(x) { } function updateTime() { + var timeformat = localStorage['timeformat']; + var date = new Date(); var h = date.getHours(); @@ -25,6 +27,10 @@ function updateTime() { var str_d = dd + " " + months[dm] + " " + dy; + if(timeformat == '12') { + h = (h + 11) % 12 + 1; + } + document.getElementById("h").innerHTML = padTime(h); document.getElementById("m").innerHTML = padTime(m); document.getElementById("s").innerHTML = padTime(s); -- cgit v1.2.3-70-g09d2