Posts

Showing posts with the label gmail-addons

How to get the client's time in a gmail add-on?

How to get the client's time in a gmail add-on? I would like to know the timezone of the user who runs the gmail add-on. Trying the following code did not comply to the client's time zone : var formattedDate = Utilities.formatDate(new Date(), "GMT", "yyyy-MM-dd'T'HH:mm:ss'Z'"); Logger.log(formattedDate); I basically want to filter my response and just show the upcoming events to the user. An Apps Script project has it's own time zone. When you deploy an Apps Script project, it does not take on the time zone of the user. Whatever you set the time zone to in the project, that will be the time zone in the project. By default, an Apps Script project is set to your time zone. And it stays that way even if you deploy the script in an add-on. You can't get the users time zone from the script (server side) code. If you had access to their calendar, or spreadsheet, then you could get the time zone of either of...