Tell us what’s happening:
The coding challenge for today has a bug
The instructions clearly state that “Minutes: Should omit leading zeros when they aren’t needed. Use “0” if the duration is less than one minute.” but the second test requires a leading zero at the minutes section of the output which by the instructions, it is supposed to be “1:6:40”
This bug makes it difficult to complete the challenge
I don’t know if anyone else faces the same problem but I’ll be grateful if this bug is fixed as soon as possible
Your code so far
function format(seconds) {
let minutes = Number.parseInt(seconds/60);
const hours = Number.parseInt(minutes/60);
seconds%=60;
if(seconds<10){
seconds=`0${seconds}`;
}
minutes%=60;
if(minutes<10){
minutes=`0${minutes}`
}
if(hours){
return `${hours}:${minutes}:${seconds}`
}else{
return `${minutes}:${seconds}`
}
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36 Edg/138.0.0.0
Challenge Information:
Daily Coding Challenge - Duration Formatter
https://www.freecodecamp.org/learn/daily-coding-challenge/2025-10-26