I suspect that
numberOfDaysToAdd
is a string... then if, for example, someDate.getDate() is 27 and numberOfDaysToAdd is "5", then
someDate.getDate() + numberOfDaysToAdd)
will be "275" rather than 32.
Parse the value to an integer before adding it up to the getDate() return value:
var numberOfDaysToAdd = parseInt($(this).val(), 10);
if (isNaN(numberOfDaysToAdd)) {
return;
}