0.1.0 • Published 4 years ago

hmn-ms v0.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

hmn-ms

Convert human readable strings to milliseconds.

Installation

$ npm install --save hmn-ms

NodeJS

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')
// -> 86400000

Documentation

Units

Find the valid units in the table below.

UnitFormats
Seconds, sec, secs, second, seconds
Minutem, min, mins, minute, minutes
Hourh, hour, hours
Dayd, day, days
Weekw, week, weeks
Yeary, year, years

Note: Months aren't supported because of inconsistency (28, 30 or 31 days).

License

MIT

0.1.0

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago