File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,6 +67,16 @@ title: Battery Runtime Tests
6767 </style >
6868
6969 <script >
70+ function formatDaysHours (totalHours ) {
71+ const h = Math .max (0 , Math .floor (totalHours));
72+ const days = Math .floor (h / 24 );
73+ const hours = h % 24 ;
74+
75+ if (days <= 0 ) return ` ${ hours} hrs` ;
76+ if (hours === 0 ) return ` ${ days} days` ;
77+ if (days === 1 ) return ` 1 day ${ hours} hrs` ;
78+ return ` ${ days} days ${ hours} hrs` ;
79+ }
7080 function updateProgress () {
7181 const startTimes = [
7282 { id: ' progress1' , start: new Date (' 2026-02-07T12:57:00' ) }, // L1 Eink 3000mAh NO GPS
@@ -91,8 +101,8 @@ title: Battery Runtime Tests
91101 startTimes .forEach (item => {
92102 const el = document .getElementById (item .id );
93103 if (! el) return ;
94- const diffInHours = Math . floor (( currentDate - item .start ) / (1000 * 60 * 60 ) );
95- el .innerText = ` Started ${ diffInHours} hrs ago` ;
104+ const diffInHours = ( currentDate - item .start ) / (1000 * 60 * 60 );
105+ el .innerText = ` Started ${ formatDaysHours ( diffInHours) } ago` ;
96106 });
97107 }
98108
You can’t perform that action at this time.
0 commit comments