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.element.append('<div class="remaining-box"><span class="remaining-text "> < 60 minutes</span><span class="bid-text animated slideInUp">See!</span></div>');
} else {
field.element.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.$,
value = arguments[1],
createdDateTime = new Date(field.row.<b>balance_date__c</b>.substr(0, field.row.<b> balance_date__c</b>.lastIndexOf('.'))),
currentDateTime = <b>skuid.$M('YourUIModel').theRowYouNeed.theFieldYouNeed</b>,
<b>theTimeYouWant = currentDateTime + createdDateTime;
</b> field.element.append(<b>theTimeYouWant </b>);