This commit is contained in:
Michael Barrett 2018-05-18 09:29:25 +01:00
parent e1dcc51622
commit 9797b474af
3 changed files with 11 additions and 1 deletions

View File

@ -1,5 +1,9 @@
# Changelog # Changelog
## 5.0.1
- Fix issue where decimal values were not being parsed correctly ([vegeta897](https://github.com/vegeta897))
## 5.0.0 ## 5.0.0
- Add `daysPerYear` configuration option - Add `daysPerYear` configuration option

View File

@ -1,6 +1,6 @@
{ {
"name": "timestring", "name": "timestring",
"version": "5.0.0", "version": "5.0.1",
"description": "Parse a human readable time string into a time based value", "description": "Parse a human readable time string into a time based value",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -92,4 +92,10 @@ describe('timestring', () => {
it('can parse a messy time string', () => { it('can parse a messy time string', () => {
expect(timestring('5 D a YS 4 h 2 0 mI nS')).to.equal(447600) expect(timestring('5 D a YS 4 h 2 0 mI nS')).to.equal(447600)
}) })
it('can parse a time string containing a decimal value', () => {
expect(timestring('1.5 hours')).to.equal(5400)
expect(timestring('2.75 mins')).to.equal(165)
expect(timestring('1.5 w')).to.equal(907200)
})
}) })