MCPcopy
hub / github.com/feiyu563/PrometheusAlert / addSubtract

Function addSubtract

static/plugins/chart.js/Chart.bundle.js:17858–17882  ·  view source on GitHub ↗
(mom, duration, isAdding, updateOffset)

Source from the content-addressed store, hash-verified

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

Callers 2

getSetOffsetFunction · 0.85
createAdderFunction · 0.85

Calls 4

absRoundFunction · 0.85
setMonthFunction · 0.85
set$1Function · 0.85
getFunction · 0.70

Tested by

no test coverage detected