Skip to content

fix(emails): Fix user's locale in emails from being overwritten by an other user#20184

Draft
xlisachan wants to merge 1 commit intomainfrom
fix_email-date
Draft

fix(emails): Fix user's locale in emails from being overwritten by an other user#20184
xlisachan wants to merge 1 commit intomainfrom
fix_email-date

Conversation

@xlisachan
Copy link
Contributor

@xlisachan xlisachan commented Mar 13, 2026

Because

  • The moment.locale() and moment.tz.setDefault() calls in date formatting functions mutated global state on the shared moment.js
  • Since Node.js processes emails concurrently (via async), one user's email could overwrite the global locale while another user's email was mid-render, causing that email to format dates with the wrong locale (e.g., MM/DD/YYYY instead of DD/MM/YYYY or vice versa)

This pull request

  • Switches to instance-level .locale (locale) so each date formatting call is self-contained and can't affect others.

Issue that this pull request solves

Closes: PAY-3575

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).

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

Successfully merging this pull request may close these issues.

1 participant