To use minutestohours from date-fns library in Javascript, you need to first install the package using npm or yarn as shown below:
28 chars2 lines
or
18 chars2 lines
Once the package is installed, you can import the minutestohours function and use it in the following way:
163 chars7 linesIn the above example, we imported the minutestoHours function from date-fns and used it to convert 120 minutes to its equivalent 2 hours. The function takes the number of minutes as its argument and returns the value in hours.
gistlibby LogSnag