Skip to content

Commit

Permalink
Create at_seed_delivery_calendar.js
Browse files Browse the repository at this point in the history
  • Loading branch information
cnative100 authored Feb 21, 2023
1 parent 3233294 commit 2f60577
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions at_seed_delivery_calendar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Seed dates in the delivery calendar, Tuesday thru Friday each week of the year.
// --------------------------

let deliveryCalendarTable = base.getTable("Delivery Calendar");
let deliveryCalendarView = deliveryCalendarTable.getView("Grid view");

let deliveryCalendarResults = await deliveryCalendarView.selectRecordsAsync({fields: ['Delivery Weekend','Subscriptions']});
let deliveryStartDate = new Date("April 11, 2023");
let deliveryIterator = new Date(deliveryStartDate);

for(let i = 0; i < 52; i++){

for(let j = 0; j < 4; j++){

let recordId = await deliveryCalendarTable.createRecordAsync({
"Delivery Weekend": new Date(deliveryIterator)
});

deliveryIterator.setDate(deliveryIterator.getDate() + 1);
}

deliveryIterator.setDate(deliveryIterator.getDate() + 3);
}

0 comments on commit 2f60577

Please sign in to comment.