Convert minutes to hours+minutes using momentjs

How do I convert minutes to hours? For example, I have the number 61, which is equal to one hour and one minute. How do I turn the number 61 into '1h. 1m'? My design doesn't work:

let time = moment(moment.duration(num, 'minutes')).format('Hч. Mм.');
Author: JamesJGoodwin, 2017-03-30

1 answers

You can't do this with momentjs, because the time frame is clearly fixed in moment. If there are more than 24 hours, the counter will start again. There is a great feature that turns minutes into the format HHч. mmм.:

function getTimeFromMins(mins) {
    let hours = Math.trunc(mins/60);
    let minutes = mins % 60;
    return hours + ':' + minutes;
};

function getTimeFromMins(mins) {
    let hours = Math.trunc(mins/60);
	let minutes = mins % 60;
	return hours + 'ч. ' + minutes + 'м.';
};

console.log(getTimeFromMins(60));
console.log(getTimeFromMins(122));
console.log(getTimeFromMins(228));
console.log(getTimeFromMins(1337));
 2
Author: JamesJGoodwin, 2017-03-31 00:19:50