Sebastien-Gath
Sebastien-Gath

Reputation: 479

Wrong date format when i create an event in google calendar

I use a google form to create event in my calendar. The date format recorded on my spreadsheet is European DD/MM/YYYY but at the event creation google calendar put the date info in the Us format MM/DD/YYYY. So, events are displayed in my calendar at the wrong dates...

Ive check my gsuite account, drive, sheet are set to the right language and timezone (FRANCE / PARIS). can you help me ? Thx.

ex. MR ZAZOU 2th March -----> 4th Feb

spreadsheet DD/MM/YYYY format

enter image description here

EDIT: last code i use to create event

function createEvent_ (namedValues) {
  //options are the key/value pairs you can set when created a 
  //calendar event, below accesses the data given for description 
  //and location - guest is hard coded
var options = { description: namedValues.Description[0],
ocation: namedValues.Location[0],
              guests:"exemple"};
  //cEvent makdes the calendar event, You have to choose the calendar 
  //name that you would like to use, then ask for the Name of the event, 
  //start date and end date, then passes the options you have selected above
  var cEvent = CalendarApp.getCalendarsByName("Example")[0].createEvent(
              namedValues.Name[0], 
              new Date(namedValues.Starts), 
              new Date(namedValues.Ends), 
              options)

}

Upvotes: 1

Views: 1729

Answers (1)

Sebastien-Gath
Sebastien-Gath

Reputation: 479

Ok, got it ! The problem was from the google form addon "Form publisher". Ive add an extra date field in my form for testing. In the form editor, the date format showed by google is the right one, but when i explore the template option of Form publisher, the format was named with wrong format.

Upvotes: 1

Related Questions