jkroso / parse-duration

convert a human readable duration to ms
MIT License
243 stars 36 forks source link

Cannot parse with multiply or division #34

Closed Yoinky3000 closed 3 years ago

Yoinky3000 commented 3 years ago

When I try to parse something like 1000*60 (multiply)

parse("1000*60");

Instead of returning 60000(which is 1 min), it returns 1060

It also happened when trying to parse something like 10000/10 (division)

parse("10000/10");

Instead of returning 1000(which is 1 sec), it returns 10010

dy commented 3 years ago

Is that anticipated user input? How would you differentiate '10/10' as date format vs as division operation? Evaluating input values seems to be way off the package scope.

Yoinky3000 commented 3 years ago

I see that this package can handle + and -, so I expect that this package can also handle and /, when I see that it handle and / incorrectly, I thought that it was an issue and open the issue.

dy commented 3 years ago

The main rule is: whatever is not in the docs - don't expect it to work)