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

Function setMonth

static/plugins/chart.js/Chart.bundle.js:15737–15760  ·  view source on GitHub ↗
(mom, value)

Source from the content-addressed store, hash-verified

15735 // MOMENTS
15736
15737 function setMonth (mom, value) {
15738 var dayOfMonth;
15739
15740 if (!mom.isValid()) {
15741 // No op
15742 return mom;
15743 }
15744
15745 if (typeof value === 'string') {
15746 if (/^\d+$/.test(value)) {
15747 value = toInt(value);
15748 } else {
15749 value = mom.localeData().monthsParse(value);
15750 // TODO: Another silent failure?
15751 if (!isNumber(value)) {
15752 return mom;
15753 }
15754 }
15755 }
15756
15757 dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
15758 mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
15759 return mom;
15760 }
15761
15762 function getSetMonth (value) {
15763 if (value != null) {

Callers 2

getSetMonthFunction · 0.85
addSubtractFunction · 0.85

Calls 3

toIntFunction · 0.85
daysInMonthFunction · 0.85
isNumberFunction · 0.70

Tested by

no test coverage detected