Skip to content

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

@kailiangchen

Description

@kailiangchen

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions