parse time durations written in plain english
npm install duration-parserparse time durations written in plain english




It's a function that parses a duration string and returns the number of milliseconds that duration represents.
``javascriptduration-parser
var parseDuration = require();
parseDuration('1 second'); // 1000
parseDuration('2 seconds'); // 2000
parseDuration('3.4s'); // 3400
parseDuration('1 minute 9 seconds'); // 69000
parseDuration('1 minute - 10 seconds'); // 50000
parseDuration('-1 minute + 10 seconds'); // -50000
parseDuration('-1 minute 10 seconds'); // -70000
`
It understands the following time constructs and abbreviations.
* milliseconds: milliseconds, millisecond, msseconds
* seconds: , second , secs , sec , sminutes
* minutes: , minute , mins , min , mhours
* hours: , hour , hrs , hr , h days
* days: , day , dweeks
* weeks: , week , wks , wk , w+
/ - and order of operations
+ and - operators perform addition and subtraction as expected.
Concatenating time measurements together (with or without whitespace) will perform addition.
`javascript`
'1h3s' == '1h + 3s' == '1 hour 3 seconds'
Concatenation has higher precedence than the + or - operators, so:
`javascript`
'1 week - 2 days 6 hours' == '1 week - (2 days + 6 hours)'
(parenthesis are not currently supported)
1. ensure your git working directory is clean (git status).2.13
2. ensure you are running npm or later, or 3.1 or later (npm --version, npm i npm@latest).cut-release
3. ensure you have installed (npm i -g cut-release).cut-release`.
4. run