Merge pull request #41 from vegeta897/patch-1
Fix parsing of decimal input values
This commit is contained in:
commit
e1dcc51622
4
index.js
4
index.js
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user