So, I have this code :
$('#end_date').click(function()
{
var start_date = new Date($('#start_date').val());
var duration = parseInt($('#duration').val());
var end_date = new Date();
end_date.setDate(start_date + duration);
$('#end_date').val($.datepicker.formatDate('yy-mm-dd', end_date));
});
Which, I believe, should take a start date from the form, and add some days (duration) in it, and the show the output in the other text field. However, the result I got is always NaN-NaN-NaN, or simply Invalid Date if I remove the formatting.
However :
$('#end_date').val($.datepicker.formatDate('yy-mm-dd', start_date));
works just fine. So I don't think the problem lies in the 3rd line. And now I confused. Any pointer to solve this problem?