When start date and no of days is given I need to calculate the end date

Tags: #<Tag:0x00007f0b0061a050>

When start date column value and the no of days column value
is given I need to calculate the end date

Hi @sindhuja.mary

I have tested some approaches and this seems to be the best one https://jsfiddle.net/x8vyeL53/6/ it allows you to use formulas like TODAY() and DATE() + add some days to it.

Hi thanks for spending your time for helping me.

My code is similar to this

var rowidex = change[0][0];
if (change[0][1] == “start_dt”) {
itemcode = ht.getDataAtRowProp(change[0][0], “start_dt”);
console.log(itemcode);
if (itemcode != undefined && itemcode != “”) {

                    var strtdate = ht.getDataAtRowProp(change[0][0], 'start_dt');
                    var leadtime = ht.getDataAtRowProp(change[0][0], 'lead_time');
                    var enddt;
                    enddt=findenddt(strtdate, leadtime);                      
                    ht.setDataAtRowProp(change[0][0], 'end_dt', enddate);
                }

function findenddt(strtdate, leadtime) {
debugger;
var date = new Date(Math.round((strtdate - (25567 + 1)) * 86400 * 1000));
var converted_date = date.toISOString().split(‘T’)[0];
console.log(converted_date)
return converted_date;
}

I used your code and did like this but I get error. I dont use excel type. Just in the handsontable date field when date is entered and there is a leadtime column which has the number of days and it needs to be calculated.
For example if my handsondata is 3 days and date is selected as 16/11/2021 I should get the value 18/11/2021 returned in the other column in the on change event.

Any help on this please

Hi @sindhuja.mary

could you please load the code to JSFiddle? It will be easier to debug and share updates.

Hi @sindhuja.mary

Have you had time to test the code in a demo?