diff --git a/frontend/app/components/shared/SessionItem/Counter.tsx b/frontend/app/components/shared/SessionItem/Counter.tsx index 5303974ae..9656ae753 100644 --- a/frontend/app/components/shared/SessionItem/Counter.tsx +++ b/frontend/app/components/shared/SessionItem/Counter.tsx @@ -1,6 +1,6 @@ import React, { useState, useEffect } from 'react' import { Duration } from 'luxon'; -import { durationFormatted, formatTimeOrDate } from 'App/date'; +import { durationFormatted, convertTimestampToUtcTimestamp } from 'App/date'; interface Props { startTime: any, @@ -9,7 +9,7 @@ interface Props { function Counter({ startTime, className }: Props) { let intervalId; - const [duration, setDuration] = useState(new Date().getTime() - startTime) + const [duration, setDuration] = useState(new Date().getTime() - convertTimestampToUtcTimestamp(startTime)); const formattedDuration = durationFormatted(Duration.fromMillis(duration)); useEffect(() => { diff --git a/frontend/app/date.js b/frontend/app/date.js index 783da4428..089c48362 100644 --- a/frontend/app/date.js +++ b/frontend/app/date.js @@ -111,3 +111,6 @@ export const checkRecentTime = (date, format) => { export const formatMs = (ms: number): string => ms < 1000 ? `${ Math.trunc(ms) }ms` : `${ Math.trunc(ms/100) / 10 }s`; +export const convertTimestampToUtcTimestamp = (timestamp: number): number => { + return DateTime.fromMillis(timestamp).toUTC().toMillis(); +} \ No newline at end of file