Mailo Světel
Mailo Světel

Reputation: 25991

JavaScript Date CET

i am working on script which creates events in Google Calendar from data in SpreadSheet. Following code creates events in default calendar.

function myFunction() {
  cal = CalendarApp.getDefaultCalendar();
  cal.createEvent(
      'Single day', 
      new Date("October 25, 2011 15:00:00 EST"), 
      new Date("October 25, 2011 16:00:00 EST"), 
      {}
  );
  cal.createAllDayEvent('All day', new Date("October 25, 2011"), {});
}

The problem is, it creates the events at wrong timing. The all day event is created OK of course

Single day event with EST timezone code All day event

I guess i am supposed to use another timezone code, but when i use CET it creates the event in the begining of epoch

function myFunction() {
  cal = CalendarApp.getDefaultCalendar();
  cal.createEvent(
      'Single day', 
      new Date("October 25, 2011 15:00:00 CET"), 
      new Date("October 25, 2011 16:00:00 CET"), 
      {}
  );
  cal.createAllDayEvent('All day', new Date("October 25, 2011"), {});
}

Event created with CET timezone code

And again all day event is OK, becouse i don't use any time zone code.

Format of Date contructor i found here http://code.google.com/intl/cs-CZ/googleapps/appsscript/class_calendar.html#createEvent

So my question is what's the correct code for Central European Time ? Better could be reference for page with these codes.

Upvotes: 2

Views: 1424

Answers (1)

Anton Soradoi
Anton Soradoi

Reputation: 1851

CET is the correct abbreviation for Central European Time.

It sounds like you found a bug, please file it on the Apps Script Issue Tracker.

Best,

Anton

Upvotes: 2

Related Questions