Reputation: 4144
No clue why I'm getting two different dates for a code below
var aDate = '12/31/2014';
var bDate = new Date(aDate);
var cDate = bDate.setMonth(bDate.getMonth() + 3);
var calDate = new Date(cDate);
var yc = calDate.getFullYear(), mc = calDate.getMonth(), dc = calDate.getDate();
alert(calDate + ' ' + mc+'/'+dc+'/'+yc);
For me mc/dc/yc should be same day as calDate
Upvotes: 1
Views: 45