Add X days to an existing date field

Hi we have something similar, that calculates remaining hours in a 48 hour timespan from a created-date.

This is a custom Field Renderer on the createdDate Field.

var field = arguments[0],    
    $ = skuid.$,
    value = arguments[1],
    createdDateTime = new Date(field.row.CreatedDate.substr(0, field.row.CreatedDate.lastIndexOf('.'))),
    currentDateTime = new Date(),
    timeDifferenceInHours = Math.ceil((currentDateTime - createdDateTime) / 1000 / 60 / 60),
    hoursLeft = 48 - timeDifferenceInHours;
if(hoursLeft <= 0) {
    field&#46;element&#46;append('<div class="remaining-box"><span class="remaining-text "> < 60 minutes</span><span class="bid-text animated slideInUp">See!</span></div>');
} else {
    field&#46;element&#46;append('<div class="remaining-box"><span class="remaining-text">' + hoursLeft + ' hours</span><span class="bid-text">See!</span></div>');
}

So I assume that you would have to change the calculation for hoursLeft to balance_date__c + days_to_add while you make this custom field renderer on the balance date field.

So something like this:

var field = arguments[0],    
    $ = skuid&#46;$,
    value = arguments[1],
    createdDateTime = new Date(field&#46;row&#46;<b>balance_date__c</b>&#46;substr(0, field&#46;row&#46;<b> balance_date__c</b>&#46;lastIndexOf('&#46;'))), 
    currentDateTime = <b>skuid&#46;$M('YourUIModel')&#46;theRowYouNeed&#46;theFieldYouNeed</b>,
    <b>theTimeYouWant = currentDateTime + createdDateTime;
</b>    field&#46;element&#46;append(<b>theTimeYouWant </b>);