mirror of
https://github.com/xvvvyz/tilde.git
synced 2026-03-11 14:44:24 +00:00
cleanup
This commit is contained in:
parent
dc586460e3
commit
6dd12e678b
1 changed files with 12 additions and 5 deletions
17
index.html
17
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 = ` <span id="am-pm">` +
|
||||
`${date.getHours() > 12 ? 'PM' : 'AM'}</span>`;
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue