//pick tables from your base here
const tableName = base.getTable("Meeting Availability");
const startDate = new Date('2023-09-05');
const endDate = new Date('2023-09-05');
const startTime = 8 * 60 * 60; // 8:00 AM in milliseconds
const endTime = 16 * 60 * 60; // 4:00 PM in milliseconds
const slotDuration = 15 * 60; // 15 minutes in milliseconds
const dailyTimeSlots = [];
for (let currentDate = new Date(startDate); currentDate <= endDate; currentDate.setDate(currentDate.getDate() + 1)) {
for (let currentTime = startTime; currentTime < endTime; currentTime += slotDuration) {
const timeSlot = new Date(currentDate.getTime() + currentTime * 1000);
dailyTimeSlots.push({
fields: {
"Time Slot": timeSlot,
Duration: 900 // 15 minutes in seconds
}
});
}
}
await tableName.createRecordsAsync(dailyTimeSlots);