Skip to content

Commit

Permalink
Merge pull request #367 from webitel/feature/add-convert-duration-wit…
Browse files Browse the repository at this point in the history
…h-minutes

feature: add convertDurationWithMinutes[WTEL-4883](https://webitel.at…
  • Loading branch information
Lera24 authored Nov 21, 2024
2 parents d95500e + 5477157 commit ee5592a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@webitel/ui-sdk",
"version": "24.12.1",
"version": "24.12.2",
"private": false,
"scripts": {
"dev": "vite",
Expand Down
13 changes: 13 additions & 0 deletions src/scripts/convertDurationWithMinutes.js
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit ee5592a

Please sign in to comment.