From 3c6612df93a77013805bce7755cb0a9e44e5a383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Sat, 26 Jun 2021 07:53:42 +0200 Subject: [PATCH] Fix hyper-precise presence MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/components/views/rooms/PresenceLabel.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/views/rooms/PresenceLabel.tsx b/src/components/views/rooms/PresenceLabel.tsx index abedb394b5..be324a8437 100644 --- a/src/components/views/rooms/PresenceLabel.tsx +++ b/src/components/views/rooms/PresenceLabel.tsx @@ -41,11 +41,11 @@ export default class PresenceLabel extends React.Component { // XXX: This would be better handled using a culture-aware library, but we don't use one yet. private getDuration(time: number): string { if (!time) return; - const t = time / 1000; + const t = Math.round(time / 1000); const s = t % 60; - const m = t / 60 % 60; - const h = t / (60 * 60) % 24; - const d = t / (60 * 60 * 24); + const m = Math.round(t / 60) % 60; + const h = Math.round(t / (60 * 60)) % 24; + const d = Math.round(t / (60 * 60 * 24)); if (t < 60) { if (t < 0) { return _t("%(duration)ss", { duration: 0 });