From 6dd12e678bceaaf5973cd22241261ad5b1d1235b Mon Sep 17 00:00:00 2001 From: Cade Scroggins Date: Thu, 13 Sep 2018 22:39:50 -0700 Subject: [PATCH] cleanup --- index.html | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 4d6e125..79b431f 100644 --- a/index.html +++ b/index.html @@ -164,8 +164,7 @@ } #am-pm { - font-size: 2rem; - margin-left: 0.3rem; + font-size: .5em; } #search-form { @@ -446,12 +445,20 @@ const date = new Date(); let hours = this._pad(date.getHours()); let amPm = ''; + if (this._twelveHour) { - hours = (date.getHours() > 12) ? date.getHours() - 12 : (date.getHours() === 0) ? 12 : date.getHours(); - amPm = (date.getHours() > 12) ? 'PM' : 'AM'; + hours = date.getHours() > 12 + ? date.getHours() - 12 + : date.getHours() === 0 + ? 12 + : date.getHours(); + + amPm = ` ` + + `${date.getHours() > 12 ? 'PM' : 'AM'}`; } + const minutes = this._pad(date.getMinutes()); - this._el.innerHTML = hours + this._delimiter + minutes + '' + amPm + ''; + this._el.innerHTML = `${hours}${this._delimiter}${minutes}${amPm}`; this._el.setAttribute('datetime', date.toTimeString()); }