diff --git a/index.js b/index.js index 7229750..a1d2ea4 100644 --- a/index.js +++ b/index.js @@ -50,7 +50,7 @@ function parse(str) { if (str.length > 100) { return; } - var match = /^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + var match = /^((?:\d+)?-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( str ); if (!match) { diff --git a/tests.js b/tests.js index 3e94007..9427390 100644 --- a/tests.js +++ b/tests.js @@ -71,6 +71,7 @@ describe('ms(string)', function() { it('should work with negative decimals', function() { expect(ms('-1.5h')).to.be(-5400000); + expect(ms('-10.5h')).to.be(-37800000); }); it('should work with negative decimals starting with "."', function() {