Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

localtimezone_() and formatDate() not quite working for "EDT" #13

Open
kailiangchen opened this issue Sep 23, 2019 · 0 comments
Open

localtimezone_() and formatDate() not quite working for "EDT" #13

kailiangchen opened this issue Sep 23, 2019 · 0 comments

Comments

@kailiangchen
Copy link

kailiangchen commented Sep 23, 2019

Hi @mikegreiling

I'm very thankful for your project and I'm using it. However I found one small problem. Basically, at least with my timezone "EDT" (Eastern Daylight Saving Time), localTimezone_() returns "EDT", but when Gmail.Utils.formatDate calls Utilities.formatDate(message.getDate(), timezone, format), it has problems taking "EDT" as the timezone input, and end up using "GMT" instead as the timezone. Therefore it ends up returning a date formatted with GMT timezone, not local timezone. While the format string is such that it still says "EDT", therefore the datetime string is wrong. (here)

I did find that (a hack) if I use Utilities.formatDate() and it would return "America/New_York", and with that as the timezone input, it gets Utilities.formatDate() working correctly. Hence the below work-around:

//my work-around
function myFormatDate(message, format) {
  return Utilities.formatDate(message.getDate(), Session.getScriptTimeZone(), format);
}

I'm using my work-around to replace Gmail.Utils.formatDate, but want to report this issue. Thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant