{"ScriptPreparationCode":"function addDeltaMonthsToDateKeyCustom(date, delta) {\r\n const [year, month] = date.split(\u0022-\u0022);\r\n const monthInt = parseInt(month, 10);\r\n const yearInt = parseInt(year, 10);\r\n let newYear = yearInt;\r\n let newMonth = monthInt \u002B delta;\r\n\r\n if (newMonth \u003E 12 || newMonth \u003C= 0) {\r\n const spilloverMonths = newMonth % 12;\r\n const spilloverYears = newMonth === 0 ? -1 : Math.floor(newMonth / 12);\r\n newMonth = newMonth \u003E 0 ? spilloverMonths : 12 \u002B spilloverMonths;\r\n newYear = yearInt \u002B spilloverYears;\r\n }\r\n const updatedDate = \u0060${newYear}-${newMonth.toString().padStart(2, \u00220\u0022)}\u0060;\r\n\r\n return updatedDate;\r\n}\r\n\r\nfunction addDeltaMonthsToDateKeyDayJs(date, delta) {\r\n return dayjs(date, \u0022YYYY-MM\u0022).add(delta, \u0022months\u0022).format(\u0022YYYY-MM\u0022);\r\n}\r\n\r\nfunction randomIntFromInterval(min, max) { // min and max included \r\n return Math.floor(Math.random() * (max - min \u002B 1) \u002B min)\r\n}\r\n\r\nvar dates = [];\r\nvar deltas = [];\r\nfor(let i = 0; i \u003C 100; i\u002B\u002B) {\r\n const year = randomIntFromInterval(1990, 2150);\r\n const month = randomIntFromInterval(1, 12).toString().padStart(2);\r\n dates.push(\u0060${year}-${month}\u0060);\r\n deltas.push(randomIntFromInterval(-100, 100));\r\n}","TestCases":[{"Name":"Manual","Code":"const transformedDates = [];\r\nfor(const [index, date] of dates.entries()) {\r\n transformedDates.push(addDeltaMonthsToDateKeyCustom(date, deltas[index]));\r\n}\r\n ","IsDeferred":false},{"Name":"Dayjs","Code":"const transformedDates = [];\r\nfor(const [index, date] of dates.entries()) {\r\n transformedDates.push(addDeltaMonthsToDateKeyDayJs(date, deltas[index]));\r\n}","IsDeferred":false}]}