I think this should do it:
(我认为应该这样做:)
var x = 12; //or whatever offset var CurrentDate = new Date(); console.log("Current date:", CurrentDate); CurrentDate.setMonth(CurrentDate.getMonth() + x); console.log("Date after " + x + " months:", CurrentDate);
I believe it should automatically handle incrementing to the appropriate year and mod-ing to the appropriate month.
(我相信它应该自动处理递增到适当的年份并修改到适当的月份。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…