Skip to content

Commit faf6ac4

Browse files
committed
Add last updated at time
1 parent 8c48351 commit faf6ac4

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

nodejs-assets/nodejs-project/index.html

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,13 @@
2222
}
2323
header {
2424
font-size: 28px;
25-
margin-top: 30px;
2625
margin-bottom: 20px;
2726
}
2827

28+
#lastUpdatedAt {
29+
margin-top: 30px;
30+
opacity: 0.6;
31+
}
2932
.content {
3033
max-width: 1000px;
3134
margin-left: 10px;
@@ -36,6 +39,7 @@
3639
#batteryPercent {
3740
font-size: 40px;
3841
font-variant-numeric: tabular-nums;
42+
font-weight: bold;
3943
}
4044
.battery-container {
4145
display: flex;
@@ -200,6 +204,7 @@
200204
</head>
201205
<body>
202206
<div class="content">
207+
<div id="lastUpdatedAt"></div>
203208
<header id="header">Fetching Battery...</header>
204209

205210
<div>
@@ -577,7 +582,6 @@
577582
const oldNum = parseFloat(
578583
existingEl.getAttribute('data-value'),
579584
);
580-
console.log(newNum, oldNum);
581585
if (oldNum !== newNum) {
582586
setTimeout(() => {
583587
let existingEl = document.getElementById(el.id);
@@ -718,6 +722,15 @@
718722
return;
719723
}
720724

725+
document.getElementById('lastUpdatedAt').innerText =
726+
'Last Updated At: ' +
727+
Intl.DateTimeFormat('en-US', {
728+
hour: 'numeric',
729+
minute: 'numeric',
730+
second: 'numeric',
731+
hour12: false,
732+
}).format(new Date());
733+
721734
const indicesOfHigh = getIndicesOfLargestNumbers(info.cellVolts);
722735
const indicesOfLow = getIndicesOfSmallestNumbers(info.cellVolts);
723736
let highVoltageIndex =

0 commit comments

Comments
 (0)