'moment js end of from now return only in hours

Does someone know how can I get in hours not days, this code below returns 3 days, I would like to return 72 hours

console.log(moment("2022-04-14T09:07:08.086Z").endOf('hours').fromNow(true))
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>


Solution 1:[1]

const toHours = (days) => { days = days.substring(0, days.indexOf(' '))
                          return 24*days
}

console.log(toHours(moment("2022-04-14T09:07:08.086Z").fromNow(true)))
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>
OR use relative threshold by moment (sometimes incorrect due to rounding off)
moment.relativeTimeThreshold('h', 24*26);

console.log(moment("2022-04-14T09:07:08.086Z").endOf('hours').fromNow(true))
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1