readable-times
Convert readable time strings to milliseconds and vice versa.
installation
npm install readable-times
usage
toReadable()
const toReadable = ; ;// => '1ms' ;// => '1y 2mo 3w 4d 5h 6m 7s 8ms' ;// => '1y;2mo;3w;4d;5h;6m;7s;8ms' ;// => ['1y','2mo','3w','4d','5h','6m','7s','8ms'] const identifiers = year: 'shana' month: 'hodesh' week: 'shavua' day: 'yom' hour: 'sha\'a' minute: 'daka' second: 'shniya' millisecond: 'milishniya';;// => '1shana 2hodesh 3shavua 4yom 5sha'a 6daka 7shniya 8milishniya'
toMilliseconds()
const toMilliseconds = ; ;// => 86400000 ;// => 38898367008 ;// => 38898367008 ;// => 38898367008 ;// => 38898367008 ;// => 123 const identifiers = year: 'shana' month: 'hodesh' week: 'shavua' day: 'yom' hour: 'sha\'a' minute: 'daka' second: 'shniya' millisecond: 'milishniya';;// => 38898367008
Available identifiers:
MILLISECOND: ['milliseconds', 'millisecond', 'millisecs', 'millisec', 'ms']
SECOND: ['seconds','second','secs','sec','s']
MINUTE: ['minutes','minute','mins','min','m']
HOUR: ['hours','hour','h']
DAY: ['days','day','d']
WEEK: ['weeks','week','w']
MONTH: ['months','month','mo']
YEAR: ['years','year','y']