While using moment, is it possible to skip 2 months always? Right now I have:
moment().add(8, weeks).startOf('month').endOf('week').add(4, 'days')
However, in some situations, this will not work. For example, if the day is June 3rd, you will end up in July instead of August. Similarly, if you added 10 weeks instead of 8 for Jan 31st, you go too far. 9 is a similar case.
Any idea how to make this not work sometimes?
Maybe this helps you
const today = moment();
const future = moment(today).add(2, 'M');
console.log(today.format('DD-MM-YYYY'));
console.log(future.format('DD-MM-YYYY'));
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>
Please, let me know if it works or not )