vydimitrov / react-countdown-circle-timer

Lightweight React/React Native countdown timer component with color and progress animation based on SVG

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Modify README for Time formatting functions

WenLonG12345 opened this issue · comments

commented

Hi, thanks for this awesome library and I love it!

However, for the time formatting functions, I notice it wont be returning 2 digits as same as the format of mm:ss.

Here is my solution for getting 2 digits.

  const timeLeft = ({ remainingTime }) => {
    const minutes = (`0${Math.floor(remainingTime / 60)}`).slice(-2);
    const seconds = (`0${remainingTime % 60}`).slice(-2);

    return <Text>{`${minutes}:${seconds}`}</Text>;
  };

image

Hope this helps!