To use the minutestohours
function from the date-fns
library in TypeScript, you can follow these steps:
date-fns
and its type declarations:52 chars3 lines
minutestohours
function and its type from date-fns
:index.ts65 chars2 lines
minutesToHours
function:index.ts165 chars5 lines
The minutesToHours
function takes a number of minutes as its argument and returns an object with the hours
and minutes
properties. The MinutesToHoursResult
type describes this object.
Here's a complete example that you can run in a TypeScript sandbox:
index.ts231 chars7 lines
gistlibby LogSnag