MCPcopy Create free account
hub / github.com/scottrogowski/code2flow / momentsDifference

Function momentsDifference

tests/test_code/js/moment/moment.js:3543–3559  ·  view source on GitHub ↗
(base, other)

Source from the content-addressed store, hash-verified

3541 }
3542
3543 function momentsDifference(base, other) {
3544 var res;
3545 if (!(base.isValid() && other.isValid())) {
3546 return { milliseconds: 0, months: 0 };
3547 }
3548
3549 other = cloneWithOffset(other, base);
3550 if (base.isBefore(other)) {
3551 res = positiveMomentsDifference(base, other);
3552 } else {
3553 res = positiveMomentsDifference(other, base);
3554 res.milliseconds = -res.milliseconds;
3555 res.months = -res.months;
3556 }
3557
3558 return res;
3559 }
3560
3561 // TODO: remove 'name' arg after deprecation is removed
3562 function createAdder(direction, name) {

Callers 1

createDurationFunction · 0.85

Calls 2

cloneWithOffsetFunction · 0.85

Tested by

no test coverage detected