cleanup
This commit is contained in:
+12
-5
@@ -164,8 +164,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#am-pm {
|
#am-pm {
|
||||||
font-size: 2rem;
|
font-size: .5em;
|
||||||
margin-left: 0.3rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#search-form {
|
#search-form {
|
||||||
@@ -446,12 +445,20 @@
|
|||||||
const date = new Date();
|
const date = new Date();
|
||||||
let hours = this._pad(date.getHours());
|
let hours = this._pad(date.getHours());
|
||||||
let amPm = '';
|
let amPm = '';
|
||||||
|
|
||||||
if (this._twelveHour) {
|
if (this._twelveHour) {
|
||||||
hours = (date.getHours() > 12) ? date.getHours() - 12 : (date.getHours() === 0) ? 12 : date.getHours();
|
hours = date.getHours() > 12
|
||||||
amPm = (date.getHours() > 12) ? 'PM' : 'AM';
|
? date.getHours() - 12
|
||||||
|
: date.getHours() === 0
|
||||||
|
? 12
|
||||||
|
: date.getHours();
|
||||||
|
|
||||||
|
amPm = ` <span id="am-pm">` +
|
||||||
|
`${date.getHours() > 12 ? 'PM' : 'AM'}</span>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const minutes = this._pad(date.getMinutes());
|
const minutes = this._pad(date.getMinutes());
|
||||||
this._el.innerHTML = hours + this._delimiter + minutes + '<span id="am-pm">' + amPm + '</span>';
|
this._el.innerHTML = `${hours}${this._delimiter}${minutes}${amPm}`;
|
||||||
this._el.setAttribute('datetime', date.toTimeString());
|
this._el.setAttribute('datetime', date.toTimeString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user