diff --git a/package.json b/package.json index 596eff57..af2f8fcc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@webitel/ui-sdk", - "version": "24.12.1", + "version": "24.12.2", "private": false, "scripts": { "dev": "vite", diff --git a/src/scripts/convertDurationWithMinutes.js b/src/scripts/convertDurationWithMinutes.js new file mode 100644 index 00000000..9c4f726e --- /dev/null +++ b/src/scripts/convertDurationWithMinutes.js @@ -0,0 +1,13 @@ +const convertDurationWithMinutes = (duration) => { + if (!duration) return '00:00'; + + let hour = `${Math.floor(duration / 60)}`; + let min = `${Math.floor(duration % 60)}`; + + if (hour.length === 1) hour = `0${hour}`; + if (min.length === 1) min = `0${min}`; + + return `${hour}:${min}`; +}; + +export default convertDurationWithMinutes;