Current and Longest streak calculation fixed
Minor refactoring and unit tests added After CR: user-stats file moved to util folder, export keywork added to exported functions, new line added at the end of gulp file User-stats-test file moved to replicate user-stats path in test folder
This commit is contained in:
11
server/utils/date-utils.js
Normal file
11
server/utils/date-utils.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import moment from 'moment';
|
||||
|
||||
// day count between two epochs (inclusive)
|
||||
export function dayCount([head, tail]) {
|
||||
return Math.ceil(
|
||||
moment(moment(head).endOf('day')).diff(
|
||||
moment(tail).startOf('day'),
|
||||
'days',
|
||||
true)
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user