Build my own Hello World

It's just a personal note.

I've implemented a code that makes schedules that express the week number of the university session.

What's this?

  • It was inconvenient for me that I could not see the week number of the session until I went to the course platform.
  • To be able to check the week number when seeing the Google Calendar, I've implemented a GAS code.

What I implemented

the code that I implemented

  • implemented a code that makes schedules in which I can see the week number.

  • Because I cannot see the start date of the session that will be held in the next year, I implemented it so that I can run the code only by changing the start date of the session.

// edit session start date(e.g. 2023/10/8)
const sessionStartDate = new Date("SESSION_START_DATE");
let sessionDate = sessionStartDate;
let weekCount = 1;
const weeksOfSession = WEEK_NUMBER_OF_SESSION;
const myCalendar = CalendarApp.getCalendarById("YOUR_EMAIL_ADDRESS");

function setNumberOfWeeks(weekCount, date){
  myCalendar.createAllDayEvent(`${weekCount} week of the session at UoL`, date, {description: "go to platform \n LINK_OF_PLATFORM"});
}

function main(){
  for (let i=weekCount; i <= weeksOfSession; i++) {
    setNumberOfWeeks(i, sessionDate);
    sessionDate.setDate(sessionDate.getDate() + 7);
  }
}

results of running the code

  • The schedule that has the right title and description was made.

  • I can see that all the schedules were made automatically.