Issue with batch script

Hello Folks,
The batch feature here works perfect and it creates 50 records in milliseconds and goes on till it finishes the total number of episodes ( EPS ), I have a tiny issue with the numerical calculation, it doesn’t work well with pattern adds to the date

So if you run this batch script to add 7 days to each date the result is not accurate

const importTable = base.getTable(“Titles”);
const importQuery = await importTable.selectRecordsAsync();
const episodesscheduletable = base.getTable(‘Episodes Schedule’);

const episodesScheduleQuery = await episodesscheduletable.selectRecordsAsync()
const episodesScheduleNames = =>

let contactsToMake = ;

for (let record of importQuery.records)
let myDate = new Date();
let RowsToCreate=0;
RowsToCreate= record.getCellValue(‘EPS’) ;
myDate = new Date(record.getCellValue(‘Release Date’));

while (RowsToCreate>0)
    myDate.setDate(myDate.getDate() + 7);    
    await episodesscheduletable.createRecordAsync({
        "Release Date": myDate 
    RowsToCreate = RowsToCreate -1   


The result

So 14+7 = 21
21+7= 28 not 27

Is there something wrong with my code, I just want to add 7 to each date add up, but it’s not working properly, Do you have a quick fix for that?

Thank you guys for your continuous help and support. Appreciate your input
waiting for your reply.

This topic was solved and automatically closed 15 days after the last reply. New replies are no longer allowed.