From 75b0351dfd23e612d934812c84c7b06e049826a8 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Thu, 10 Feb 2022 23:55:26 +0100 Subject: [PATCH] feat(ui) - live session item duration change --- frontend/app/components/shared/SessionItem/Counter.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/app/components/shared/SessionItem/Counter.tsx b/frontend/app/components/shared/SessionItem/Counter.tsx index 7244d7035..5303974ae 100644 --- a/frontend/app/components/shared/SessionItem/Counter.tsx +++ b/frontend/app/components/shared/SessionItem/Counter.tsx @@ -1,5 +1,6 @@ import React, { useState, useEffect } from 'react' import { Duration } from 'luxon'; +import { durationFormatted, formatTimeOrDate } from 'App/date'; interface Props { startTime: any, @@ -9,6 +10,7 @@ interface Props { function Counter({ startTime, className }: Props) { let intervalId; const [duration, setDuration] = useState(new Date().getTime() - startTime) + const formattedDuration = durationFormatted(Duration.fromMillis(duration)); useEffect(() => { if (!intervalId) { @@ -21,7 +23,7 @@ function Counter({ startTime, className }: Props) { return (
- {startTime && Duration.fromMillis(duration).toFormat('m:ss')} + {startTime && formattedDuration}
) }