@ -9,9 +9,13 @@ export function StreamTimer({ ev }: { ev?: NostrEvent }) {
|
|||||||
function updateTime() {
|
function updateTime() {
|
||||||
const starts = Number(findTag(ev, "starts") ?? unixNow());
|
const starts = Number(findTag(ev, "starts") ?? unixNow());
|
||||||
const diff = unixNow() - starts;
|
const diff = unixNow() - starts;
|
||||||
const hours = Number(diff / 60.0 / 60.0);
|
const min = 60;
|
||||||
const mins = Number((diff / 60) % 60);
|
const hour = min * 60;
|
||||||
setTime(`${hours.toFixed(0).padStart(2, "0")}:${mins.toFixed(0).padStart(2, "0")}`);
|
|
||||||
|
const hours = Math.floor(diff / hour);
|
||||||
|
const mins = Math.floor((diff % hour) / min);
|
||||||
|
const secs = Math.floor(diff % min);
|
||||||
|
setTime(`${hours.toFixed(0).padStart(2, "0")}:${mins.toFixed(0).padStart(2, "0")}:${secs.toFixed(0).padStart(2, "0")}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
Reference in New Issue
Block a user