timeTo
A tiny utility to convert time to another unit
Installation
$ npm install timeto
Usage
Supported time units:
- y - Year (defined as 365.25 days)
- d - Day
- h - Hours
- m - Minutes
- s - Seconds
- ms - Milliseconds
It can also take an object of shape { /* time unit */ h: 12 /* amount */ }
Alternatively you can pass a number as the input specified as a time period in milliseconds and return it in another duration
Returns a number that is the input time duration in terms of the output time unit specified
Example
const timeTo = const msValue = console // 129600000
Additional notes
- Time units must be lowercase
- Months are not supported since they fluctuate in duration