react-pretty-duration is a reactjs package converting numbered duration to user friendly duration text.
Use the npm to install react-pretty-duration.
npm install react-pretty-durationimport React from 'react';
import PrettyDuration from 'react-pretty-duration';
const App = () => {
return (
// provide total minutes
<PrettyDuration duration={200} />
)
}
// result => 3hr 20min| props | type | default | description | required |
|---|---|---|---|---|
| duration | number | 0 | numbered duration in minutes, must be greater than 0 | true |
| className | string | 0 | className for element styling | false |
| style | style object | 0 | object for inline styling | false |
This package uses react hooks, so would works with [email protected] or greater
MIT