From f35c1cf5480f7506442ac4c9170c5e0a1a4a8b15 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Wed, 4 May 2022 12:52:25 +0300 Subject: feat: remove material UI and useless functionality --- src/utils/convertTimeToString.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/utils/convertTimeToString.ts (limited to 'src/utils/convertTimeToString.ts') diff --git a/src/utils/convertTimeToString.ts b/src/utils/convertTimeToString.ts new file mode 100644 index 0000000..098f34a --- /dev/null +++ b/src/utils/convertTimeToString.ts @@ -0,0 +1,18 @@ +export default (timeDelta: number): string => { + let resultTime = ''; + + const minute = Math.floor(timeDelta / 60000); + if (minute < 10) resultTime += '0'; + resultTime += minute + ':'; + + let second = Math.floor(timeDelta / 1000); + if (second > 59) second %= 60; + if (second < 10) resultTime += '0'; + resultTime += second + ':'; + + const mill = Math.floor((timeDelta % 1000) / 10); + if (mill < 10) resultTime += '0'; + resultTime += mill; + + return resultTime; +}; -- cgit v1.2.3