Skip to content

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

Merged
xlisachan merged 1 commit into
mainfrom
fix_email-date
Apr 30, 2026
Merged

fix(emails): Fix user's locale in emails from being overwritten by an other user#20184
xlisachan merged 1 commit into
mainfrom
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
@xlisachan xlisachan merged commit 4b1385c into main Apr 30, 2026
22 checks passed
@xlisachan xlisachan deleted the fix_email-date branch April 30, 2026 16:28
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.

2 participants