Skip to content

Commit

Permalink
CORE-2002 Update VICE countdown timer format
Browse files Browse the repository at this point in the history
Display countdown timer as "Time Remaining: HH:MM", without units.
  • Loading branch information
psarando committed Aug 14, 2024
1 parent 05e192f commit f1fb171
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/analyses/useAnalysisTimeLimitCountdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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(":");
}
}
}
Expand Down

0 comments on commit f1fb171

Please sign in to comment.