1.1.2 • Published 6 years ago

string-to-ms v1.1.2

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

String To Milliseconds

Module that converts the string into milliseconds. Understands following macross:

TimeMacrosExample
weekw7w
dayd31d
hourh24h
minutem60m
seconds60s

Number without macros would be interpreted as milliseconds.

Installation

npm install string-to-ms

Usage

const stringToMs = require('string-to-ms');

// return 1814400000
stringToMs('  3w  ');

// return 43200000
stringToMs('0.5d');

// return 43200000
stringToMs('12h');

// return 600
stringToMs(600);

// return 1371600000
stringToMs('1d 4d 10d 20h 1h');

// return 202147207000
stringToMs('2335d  0112h 12112dsds 7s');

Changelog

2017-12-17:

  • Now works in browser too
1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago