Hi everyone I use Date js library and have a problem with adding additional months.
Here my simple code:
var durationMonth = $('#periodId').find(':selected').data('id'); // value => 3 m
var startDate = $('#comencingDate').val(); // value -> 2015.12.14
$('#expiringDate').val(Date.parse(startDate + ' + ' + durationMonth).toString("yyyy-MM-dd"));
// This return 2016-03-03, but have to return 2016-03-13
Here little demo http://jsfiddle.net/d9rttxta/1/
The problem is only with months, with days and years work ok. If you have any suggestion I will be very glad to hear. Thanks in advance.
Expected Result: 2016-03-13
Actual Result: 2016-03-03