(mom, duration, isAdding, updateOffset)
| 17856 | } |
| 17857 | |
| 17858 | function addSubtract (mom, duration, isAdding, updateOffset) { |
| 17859 | var milliseconds = duration._milliseconds, |
| 17860 | days = absRound(duration._days), |
| 17861 | months = absRound(duration._months); |
| 17862 | |
| 17863 | if (!mom.isValid()) { |
| 17864 | // No op |
| 17865 | return; |
| 17866 | } |
| 17867 | |
| 17868 | updateOffset = updateOffset == null ? true : updateOffset; |
| 17869 | |
| 17870 | if (months) { |
| 17871 | setMonth(mom, get(mom, 'Month') + months * isAdding); |
| 17872 | } |
| 17873 | if (days) { |
| 17874 | set$1(mom, 'Date', get(mom, 'Date') + days * isAdding); |
| 17875 | } |
| 17876 | if (milliseconds) { |
| 17877 | mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); |
| 17878 | } |
| 17879 | if (updateOffset) { |
| 17880 | hooks.updateOffset(mom, days || months); |
| 17881 | } |
| 17882 | } |
| 17883 | |
| 17884 | var add = createAdder(1, 'add'); |
| 17885 | var subtract = createAdder(-1, 'subtract'); |
no test coverage detected