freeCodeCamp/server/utils/date-utils.js

12 lines
249 B
JavaScript

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)
);
}