Merge pull request #41 from vegeta897/patch-1

Fix parsing of decimal input values
This commit is contained in:
Michael Barrett 2018-05-18 09:21:24 +01:00 committed by GitHub
commit e1dcc51622
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,11 +54,11 @@ function parseTimestring (string, returnUnit, opts) {
let groups = string
.toLowerCase()
.replace(/[^.\w+-]+/g, '')
.match(/[-+]?[0-9]+[a-z]+/g)
.match(/[-+]?[0-9.]+[a-z]+/g)
if (groups !== null) {
groups.forEach(group => {
let value = group.match(/[0-9]+/g)[0]
let value = group.match(/[0-9.]+/g)[0]
let unit = group.match(/[a-z]+/g)[0]
totalSeconds += getSeconds(value, unit, unitValues)