Skip to content

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

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

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
Copy Markdown
Contributor

@xlisachan xlisachan commented Mar 13, 2026

Because

  • moment.tz.setDefault() and moment.locale() are global mutations
  • 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.

@xlisachan xlisachan marked this pull request as ready for review April 8, 2026 15:49
@xlisachan xlisachan requested a review from a team as a code owner April 8, 2026 15:49
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