My GAS script can’t create events without any errors


I want to make a script that creates events from specific emails, and I made it. When I run it, it was completed without exceptions. But no events appeared on my actual calendar.
I think my code is not wrong. I’m wondering if I need to configure some authentication settings to create events.
I would appreciate it if you could teach me the way to solve this problem.

What I tried

  • I checked I could read events through GAS.
  • I read emails that I want from GAS.
  • I checked if the default calendar ID is correct, and it was the correct one.

Code and console log

The code and output are below.

function myFunction() {
 var event = CalendarApp.getDefaultCalendar().createEvent(
   new Date("2021", "02", "20", "10", "05"),
   new Date("2021", "02", "28", "10", "30"));
 console.log('Event ID: ' + event.getTitle() + ' is created');
5:52:52 PM  Notice  Execution started
5:54:17 PM  Info    Event ID: test is created
5:52:53 PM  Notice  Execution completed

Source: Ask Javascript Questions