Skip to content

Latest commit

 

History

History
50 lines (35 loc) · 1.34 KB

README.md

File metadata and controls

50 lines (35 loc) · 1.34 KB

react-pretty-duration

npm bundle size npm npm NPM

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

react-pretty-duration

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