Closed rooooonald closed 7 months ago
{hours ? hours : "00"}:{minutes ? minutes : "00"}:{seconds ? seconds : "00"} use this code in render function to show 00
const renderer = ({ hours, minutes, seconds, completed }) => {
if (completed) {
// Render a completed state
return ;
} else {
// Render a countdown
return {hours ? hours : "00"}:{minutes ? minutes : "00"}:{seconds ? seconds : "00"};
}
};
Hi, a bit late to this, but in case anyone is running into the same issue.
When using a custom renderer
, the formatted output can be found in the formatted
object provided to the renderer
function.
<Countdown date={Date.now() + 10000} zeroPadTime={2} renderer={({ formatted: { hours, minutes, seconds } }) => {
return (
<>
{hours}:{minutes}:{seconds}
</>
);
}}
/>;
Even I set zeroPadTime={2}, still no zero is padded. ;(
<Countdown date={event.datetime} renderer={renderer} zeroPadTime={2} onComplete={timesUpHandler} />