react-pretty-duration
v1.1.1
Published
Reactjs tinny package to convert numbered duration to human friendly text.
Downloads
4
Maintainers
Readme
react-pretty-duration
react-pretty-duration is a reactjs package converting numbered duration to user friendly duration text.
Installation
Use the npm to install react-pretty-duration.
npm install react-pretty-duration
Usage
import React from 'react';
import PrettyDuration from 'react-pretty-duration';
const App = () => {
return (
// provide total minutes
<PrettyDuration duration={200} />
)
}
// result => 3hr 20min
Demo
Props
| 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 |
Notice
This package uses react hooks, so would works with [email protected] or greater
License
MIT