(mom, duration, isAdding, updateOffset)
| 3585 | } |
| 3586 | |
| 3587 | function addSubtract(mom, duration, isAdding, updateOffset) { |
| 3588 | var milliseconds = duration._milliseconds, |
| 3589 | days = absRound(duration._days), |
| 3590 | months = absRound(duration._months); |
| 3591 | |
| 3592 | if (!mom.isValid()) { |
| 3593 | // No op |
| 3594 | return; |
| 3595 | } |
| 3596 | |
| 3597 | updateOffset = updateOffset == null ? true : updateOffset; |
| 3598 | |
| 3599 | if (months) { |
| 3600 | setMonth(mom, get(mom, 'Month') + months * isAdding); |
| 3601 | } |
| 3602 | if (days) { |
| 3603 | set$1(mom, 'Date', get(mom, 'Date') + days * isAdding); |
| 3604 | } |
| 3605 | if (milliseconds) { |
| 3606 | mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); |
| 3607 | } |
| 3608 | if (updateOffset) { |
| 3609 | hooks.updateOffset(mom, days || months); |
| 3610 | } |
| 3611 | } |
| 3612 | |
| 3613 | var add = createAdder(1, 'add'), |
| 3614 | subtract = createAdder(-1, 'subtract'); |
no test coverage detected