When a reply to an email message is made using the email client, the OOB "insert_original_email_message" Email Script prints PST timezone instead of user timezone
Even though the “glide.email.append.timezone” value is set to true and that the system properties has the correct timezone as do the user records.
Steps to reproduce:
- Enable the glide.ui16.emailStreamResponseActions system property.
- Open any incident and check for the “email sent” in the activity formatter, In the email details reply, reply all, forward button are visible.
- On clicking the reply button, the email client will open and in that one can observer the “On 2020-02-27 05:47:19 PST, 'system' wrote:
- Here if the system property has different system time zone eg: GMT, though the system returns the PST in email client.
This reply form is controlled by “reply-sent” email client template which in turn calls the OOB email script “insert_original_email_message”. The script uses toLocaleString() to get this default PST timezone conversion, because date is a built-in JS object, toLocaleString() uses browser's default locale. If browser's locale is not defined, it uses system locale.
Update the email script to use GlideDateTime to honour system property/user timezone preferences.
Change the line in the email script “insert_original_email_message” code from
template.print("On " + cdate.toLocaleString() + ", '" + uname + "' wrote:\n\n");
var gdt = new GlideDateTime(cdate);
var curr_date = gdt.getDisplayValue();
template.print("On " + curr_date + ", '" + uname + "' wrote:\n\n");
Please ensure all testing is done on sub-production instances before implemented on a production instance