source: sources/client/src/utils/convertMinToString.js

Last change on this file was bc20307, checked in by Tasevski2 <39170279+Tasevski2@…>, 2 years ago

Push before video

  • Property mode set to 100644
File size: 617 bytes
Line 
1export const convertMinutesToString = (min) => {
2 let days = Math.floor(min / 1440);
3 let hours = Math.floor((min - days * 1440) / 60);
4 let minutes = Math.floor(min - (days * 1440 + hours * 60));
5 let daysString = days ? (days > 1 ? `${days} денови` : `${days} ден`) : '';
6 let hoursString = hours
7 ? hours > 1
8 ? `${hours} часови`
9 : `${hours} час`
10 : '';
11 let minutesString = minutes !== 1
12 ? `${minutes} минути`
13 : `${minutes} минута`;
14
15 return `${daysString} ${hoursString} ${minutesString}`.trim();
16};
Note: See TracBrowser for help on using the repository browser.