Time Unit Conversion utility that mimics the conversion functionality of Java's TimeUnit class.
- Easy to use
- Parses strings with time units
- Low overhead
- No dependencies
Install via npm.
npm install time-unit --save
To use time unit in your project:
const TimeUnit = require( 'time-unit' );
let milliseconds = TimeUnit.seconds.toMillis( 1 );
// milliseconds = 1000
let minutes = TimeUnit.hours.toMinutes( 1 );
// minutes = 60
let milliseconds = TimeUnit.milliseconds.parse( '1s' );
// milliseconds = 1000
We'd love to get feedback on how to make this tool better. Feel free to contact us at [email protected]