diff options
author | eug-vs <eugene@eug-vs.xyz> | 2022-05-04 12:52:25 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2022-05-04 12:52:25 +0300 |
commit | f35c1cf5480f7506442ac4c9170c5e0a1a4a8b15 (patch) | |
tree | 94fa0fa38e8a90df08933c05910bea6bed461291 /src/utils | |
parent | 8dc803f882f31430abb600fba250fdcf3334d9bf (diff) | |
download | chrono-cube-ui-f35c1cf5480f7506442ac4c9170c5e0a1a4a8b15.tar.gz |
feat: remove material UI and useless functionality
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/convertTimeToString.ts | 18 |
1 files changed, 18 insertions, 0 deletions
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; +}; |