0.1.0 • Published 6 years ago
hmn-ms v0.1.0
hmn-ms
Convert human readable strings to milliseconds.
Installation
$ npm install --save hmn-msNodeJS
const ms = require('hmn-ms')Webpack
import ms from 'hmn-ms'Usage
The formatting is flexible as long as the units are valid. It ignores white-space and is case-insensitive. The following examples are equal.
ms('1.5 days')
// -> 86400000
ms('1d 12h')
// -> 86400000
ms('34 HOurs110 min 600S')
// -> 86400000Documentation
Units
Find the valid units in the table below.
| Unit | Formats |
|---|---|
| Second | s, sec, secs, second, seconds |
| Minute | m, min, mins, minute, minutes |
| Hour | h, hour, hours |
| Day | d, day, days |
| Week | w, week, weeks |
| Year | y, year, years |
Note: Months aren't supported because of inconsistency (28, 30 or 31 days).
License
MIT