Skip to content

Conversation

@dashed
Copy link
Member

@dashed dashed commented Nov 10, 2025

Replace timezone-dependent Date/moment formatting with direct string formatting to ensure expiration dates display correctly for all users regardless of browser or account timezone settings.

Previous implementation created Date objects at browser-local midnight and formatted them using the user's account timezone preference (set via moment.tz.setDefault), causing month shifts when browser timezone was ahead of account timezone.


Root cause:

  1. Source:
    <Text>{`****${subscription.paymentSource.last4} ${moment(new Date(subscription.paymentSource.expYear, subscription.paymentSource.expMonth - 1)).format('MM/YY')}`}</Text>
  2. We create new Date(2030, 7) in the browser's local timezone. So moment() will parse Date objects in the browser's local timezone.
  3. Set moment.tz.setDefault(userTimeZone); using the user's timezone preferences (populated from backend)
    moment.tz.setDefault(userTimeZone);
  4. We display the moment objects in the user's timezone preferences.

Replace timezone-dependent Date/moment formatting with direct string
formatting to ensure expiration dates display correctly for all users
regardless of browser or account timezone settings.

Previous implementation created Date objects at browser-local midnight
and formatted them using the user's account timezone preference (set
via moment.tz.setDefault), causing month shifts when browser timezone
was ahead of account timezone.
@dashed dashed self-assigned this Nov 10, 2025
@dashed dashed requested a review from a team as a code owner November 10, 2025 23:13
@linear
Copy link

linear bot commented Nov 10, 2025

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 10, 2025
Copy link
Member

@isabellaenriquez isabellaenriquez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@dashed dashed merged commit 2afcbbb into master Nov 12, 2025
48 checks passed
@dashed dashed deleted the billing/BIL-1733 branch November 12, 2025 17:36
@sentry
Copy link

sentry bot commented Nov 13, 2025

Issues attributed to commits in this pull request

This pull request was merged and Sentry observed the following issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants