1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.differenceInDays = differenceInDays;
|
7 |
|
8 | var _moment = require('moment');
|
9 |
|
10 | var _moment2 = _interopRequireDefault(_moment);
|
11 |
|
12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 | function differenceInDays(start, end) {
|
26 | var startMoment = start ? (0, _moment2.default)(start) : (0, _moment2.default)();
|
27 | var endMoment = (0, _moment2.default)(end);
|
28 | var duration = _moment2.default.duration(startMoment.diff(endMoment));
|
29 |
|
30 | return {
|
31 | days: startMoment.diff(endMoment, 'days'),
|
32 | hours: duration.hours(),
|
33 | minutes: duration.minutes(),
|
34 | seconds: duration.seconds()
|
35 | };
|
36 | } |
\ | No newline at end of file |