I have this code to add a reminder to a calendar
function addCalendarEvent(eventDate, eventTitle){
let dateObj = new Date(eventDate);
let calendarId = "me@gmail.com";
let cal = CalendarApp.getCalendarById(calendarId);
let event = cal.createAllDayEvent(eventTitle, dateObj)
event.addEmailReminder(420)
}
The eventDate
is passed into the function as a string
in the format dd/MM/YYYY
but the output from let dateObj = new Date(eventDate);
is in american format. ie. 02/10/2020
comes out as Mon Feb 10 2020 00:00:00 GMT+0000 (Greenwich Mean Time)
. Any help correcting this would be great. Dates give me an absolute headache