Skip to content

Commit 0c6ab0c

Browse files
committed
Use minute rounding on remote schedule
1 parent 6807d60 commit 0c6ab0c

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

src/pages/Competition/Remote/RemoteActivityList.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313
} from '@/lib/notifyCompRemoteActivities';
1414
import { formatTime, formatTimeRange } from '@/lib/time';
1515

16+
const REMOTE_TIME_ROUNDING_MINUTES = 1;
17+
1618
const formatStartedDuration = (startTime: string, now: Date) => {
1719
const { hours, minutes } = intervalToDuration({
1820
start: new Date(startTime),
@@ -23,15 +25,25 @@ const formatStartedDuration = (startTime: string, now: Date) => {
2325
};
2426

2527
const stateDescription = (state: RemoteActivityState, now: Date) => {
28+
const timeZone = groupTimeZone(state.scheduledActivity);
29+
2630
if (state.liveActivity?.startTime && !state.liveActivity.endTime) {
2731
return `Started ${formatStartedDuration(state.liveActivity.startTime, now)} ago`;
2832
}
2933

3034
if (state.liveActivity?.endTime) {
31-
return `Ended at ${formatTime(state.liveActivity.endTime)}`;
35+
return `Ended at ${formatTime(
36+
state.liveActivity.endTime,
37+
REMOTE_TIME_ROUNDING_MINUTES,
38+
timeZone,
39+
)}`;
3240
}
3341

34-
return `Should start at ${formatTime(state.scheduledActivity.startTime)}`;
42+
return `Should start at ${formatTime(
43+
state.scheduledActivity.startTime,
44+
REMOTE_TIME_ROUNDING_MINUTES,
45+
timeZone,
46+
)}`;
3547
};
3648

3749
const groupActivityName = (activity: RemoteScheduledActivity) =>
@@ -190,7 +202,7 @@ export function RemoteGroupList({ disabled, groups, onSelectGroup }: RemoteGroup
190202
{formatTimeRange(
191203
firstActivity.startTime,
192204
firstActivity.endTime,
193-
5,
205+
REMOTE_TIME_ROUNDING_MINUTES,
194206
groupTimeZone(firstActivity),
195207
)}
196208
</span>

0 commit comments

Comments
 (0)