From f1fb17193456ba34d700abe5dc4fc57aec3feb1c Mon Sep 17 00:00:00 2001 From: Paul Sarando Date: Wed, 14 Aug 2024 14:09:46 -0700 Subject: [PATCH] CORE-2002 Update VICE countdown timer format Display countdown timer as "Time Remaining: HH:MM", without units. --- src/components/analyses/useAnalysisTimeLimitCountdown.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/analyses/useAnalysisTimeLimitCountdown.js b/src/components/analyses/useAnalysisTimeLimitCountdown.js index cfc0b24dc..11bb6f970 100644 --- a/src/components/analyses/useAnalysisTimeLimitCountdown.js +++ b/src/components/analyses/useAnalysisTimeLimitCountdown.js @@ -7,7 +7,7 @@ * `/analyses/${id}/time-limit` endpoint, and converted into milliseconds. * * The countdown timer value is calculated from this time limit value, - * and formatted as `HHh:MMm`. + * and formatted as `HH:MM`. * * Updates the countdown timer value every minute. */ @@ -36,7 +36,9 @@ const timeLimitToCountdown = (timeLimitMS) => { const hours = millisecondsToHours(millisRemaining); const mins = millisecondsToMinutes(millisRemaining) - hours * 60; if (mins > 0 || hours > 0) { - return `${hours}h:${mins}m`; + return [hours, mins] + .map((n) => String(n).padStart(2, "0")) + .join(":"); } } }