This is the stack answer I followed:
To create:
let start = new Date(data.start_date);
let end = new Date(start.setMonth(start.getMonth() + 1));
start = start.toISOString().split('T')[0]
end = end.toISOString().split('T')[0]
console.log(start, end);
- Expected:
start: 2022-07-23 end: 2022-08-23
- Actual:
start: 2022-07-23 end: 2022-07-23
Is this not how you properly add a month to a date?
The stack answer states it is correct, am I missing something?