date-streaks
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -27,4 +27,4 @@ 'use strict'; | ||
return dates.sort(function (a, b) { | ||
return (0, _moment2.default)(b).diff((0, _moment2.default)(a)) > 0 ? 0 : 1; | ||
}); | ||
return (0, _moment2.default)((0, _moment2.default)(b).startOf('day')).format('X') - (0, _moment2.default)((0, _moment2.default)(a).startOf('day')).format('X'); | ||
}).reverse(); | ||
}; |
{ | ||
"name": "date-streaks", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Find a variety of streak metrics from a list of dates.", | ||
@@ -11,3 +11,10 @@ "main": "./dist/index.js", | ||
}, | ||
"keywords": ["streak", "streaks", "date", "days", "dates", "day"], | ||
"keywords": [ | ||
"streak", | ||
"streaks", | ||
"date", | ||
"days", | ||
"dates", | ||
"day" | ||
], | ||
"author": "Jon Samp", | ||
@@ -14,0 +21,0 @@ "license": "ISC", |
@@ -41,2 +41,21 @@ var moment = require('moment'); | ||
}); | ||
it('should report a streak longer than 10 days', () => { | ||
var longStreak = summary({ | ||
dates: [ | ||
new Date('08/19/2018'), | ||
new Date('08/18/2018'), | ||
new Date('08/17/2018'), | ||
new Date('08/16/2018'), | ||
new Date('08/15/2018'), | ||
new Date('08/14/2018'), | ||
new Date('08/13/2018'), | ||
new Date('08/12/2018'), | ||
new Date('08/11/2018'), | ||
new Date('08/10/2018'), | ||
new Date('08/09/2018') | ||
] | ||
}); | ||
expect(longStreak.longestStreak).to.equal(11); | ||
}); | ||
}); | ||
@@ -43,0 +62,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17494
279