davepar / gcalendarsync

Apps Script for syncing a Google Spreadsheet with Google Calendar
MIT License
163 stars 47 forks source link

Wrong date for all day events #46

Open spelverso opened 6 years ago

spelverso commented 6 years ago

Hi, first of all I want to say a big thank you for your script: it rocks!

Then to the issue. For any event, if a leave blank cell in end time column, the script results correctly in a all day event BUT on the wrong day in calendar. One day before the correct day. In example, if start time is 4 of may 2018 on the sheet then the event will be write on 3 of may, if is 21 June will be write on 20 of June and so on...

Could you help me please?

evangjes commented 6 years ago

I have this same issue. I have tried increasing sheetEvent.starttime by 1 on line 416, but it doesn't have the desired effect. Hopefully Dave finds the time to sort this small issue in what's ultimately a fantastic piece of code.

Thanks for all your hard work Dave!

spelverso commented 6 years ago

All ok here now. Don't know why but.. brilliant :-)

Il Mer 13 Giu 2018, 19:12 evangjes notifications@github.com ha scritto:

I have this same issue. I have tried increasing sheetEvent.starttime by 1 on line 416, but it doesn't have the desired effect. Hopefully Dave finds the time to sort this small issue in what's ultimately a fantastic piece of code.

Thanks for all your hard work Dave!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Davepar/gcalendarsync/issues/46#issuecomment-397015195, or mute the thread https://github.com/notifications/unsubscribe-auth/Ak25UqjXXNHLDv3Wev1FRkRM9wcBao20ks5t8Uf1gaJpZM4TfZPF .

davepar commented 6 years ago

Sorry for the delay. Distracted with other activities lately. The first thing I would check is the time zone in File -> Spreadsheet Settings.

evangjes commented 6 years ago

How I fixed it:

Ctrl+f in the google script. The only result is in the "appsscript". I clicked on it, and saw the following 6 lines of code:

{ "timeZone": "America/Los_Angeles", "dependencies": { }, "exceptionLogging": "STACKDRIVER" }

Since I'm on the east coast, I changed line 2 to:

"timeZone": "America/New_York",

After saving the code, I went back to my spreadsheet and updated to the calendar, and all the full day events corrected to the right day.

Formatting of additional time zones can be found here: https://momentjs.com/timezone/

EDIT: My spreadsheet and calendar time zones were correct from the beginning. This "timeZone" variable must be independent from those two settings.

laraklee commented 4 years ago

Hi, All:

First off, Dave, thank you so much! This could be the answer to a prayer as our school is apparently transitioning to Google Classroom.

One question for the group, though... I'm still getting the time stamp error. It appears to be a 2 hour time difference (which does result in the all day events being one day off since it wants to put 0:00:00 as the time if you just put in a day), and I've checked both time zone settings and changed appsscript as suggested by evangjes. Anyone with other ideas to help this newbie to Google scripts?

Many thanks!

2/12 P.S. Got this one solved, I think, with some advice from my DH. There is a third place to set the timezone: In the spreadsheet itself under Spreadsheet Settings. Now, it works like a charm!

davepar commented 4 years ago

Glad you were able to solve the issue. For people that run into this in the future, this documentation link might be useful: https://developers.google.com/apps-script/reference/base/session#getScriptTimeZone()

jacksingh99 commented 4 years ago

How I fixed it:

Ctrl+f in the google script. The only result is in the "appsscript". I clicked on it, and saw the following 6 lines of code:

{ "timeZone": "America/Los_Angeles", "dependencies": { }, "exceptionLogging": "STACKDRIVER" }

Since I'm on the east coast, I changed line 2 to:

"timeZone": "America/New_York",

After saving the code, I went back to my spreadsheet and updated to the calendar, and all the full day events corrected to the right day.

Formatting of additional time zones can be found here: https://momentjs.com/timezone/

EDIT: My spreadsheet and calendar time zones were correct from the beginning. This "timeZone" variable must be independent from those two settings.

This worked for me. Thanks Evengjes!