Hello Everyone,
I am trying to convert a string value to a datetime ?
or how can I add a no of dates on a date format?
Example, I have a date 08/16/2020 I would like to add 5 days to be 08/21/2020 in Scripting block
I have this script, to create all number of eps and create the date assigned to that specific episode
I have the start date value, and I have No of eps value.
I tried to use a moment to add a duration of days, but it’s not working for me
moment.duration().add(1,date)
let importTable = base.getTable(“Titles”);
let importQuery = await importTable.selectRecordsAsync();
let episodesscheduletable = base.getTable(‘Episodes Schedule’);
for (let record of importQuery.records) {
let rowcount =0;
rowcount= record.getCellValue(‘EPS’)
while (rowcount>=0)
{
if (rowcount===0)
{
}else
{
//let now = new Date().toLocaleDateString("");
let date =record.getCellValue(‘Start Date’)
var rightNow = new Date();
//rightNow=date.
let Pattern=record.getCellValue(‘Release Pattern’)
let fullName = record.getCellValue(‘English Title’) + ’ ’ + record.getCellValue(‘Season’) + ’ EP’ + rowcount ;
//if (Pattern===1){ moment.duration().add(1,date);}
//if (Pattern===2){ date=date+6}
//if (Pattern===3){ date=date+5}
//if (Pattern===4){ date=date+4}
//if (Pattern===5){ date=date+3}
//if (Pattern===6){ date=date+2}
//if (Pattern===7){ date=date+1}
//if (Pattern===0){ date=date+rowcount}
await episodesscheduletable.createRecordAsync({
“Name”: fullName,“Release Date”:date
})
}
rowcount=rowcount-1
}
output.text(New record for created!);
}
