Skip to content

[$250] Incorrect report start date reflects in report title, date displays previous day #70474

Closed

Description

@lanitochka17

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.2.12-3
Reproducible in staging?: Y
Reproducible in production?: N
If this was caught during regression testing, add the test name, ID and link from TestRail: #69147
Email or phone of affected tester (no customers): applausetester+ck91125@applause.expensifail.com
Issue reported by: Applause - Internal Team

Action Performed:

Precondition: Account setup for BETA access on OD

  1. Navigate to staging.new.expensify.com
  2. Go to Workspaces settings page
  3. Go to Reports section
  4. Edit Default report title with:
    {report:type} - {report:total} from {report:policyname} on {report:startdate}
  5. Save the formula
  6. Create new report via FAB
  7. Add at least one expense transaction
  8. Observe the report title - Start date shows previous day
  9. Go back to expense preview & back to details page
  10. Observe correct date get reflected

Expected Result:

On step 8 - Correct current report date should display. In may case, date should be 2025-09-11, but it shows as 2025-09-10

Actual Result:

  1. Incorrect report start date reflects in report title, date displays previous day
  2. Also, "Custom" word missing in report title. Title displayed as "Expense Report - USD$X.XX from [WorkspaceName] on [StartDate]".
    Note: Issue happens with "Test case 7 - Transactions" scenario too the report formula "Report from {report:startdate}" - Incorrect transaction dates which are previous dates are reflected when submitting expenses in offline mode (Please check the arttached mweb recording)

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop
Platforms Tested: On which of our officially supported platforms was this issue tested:
  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Bug6942173_1757630434495.Recording__4.mp4
Bug6942173_1757635396555.Screenrecording_09-11-2025_19-49-20_1.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @suneox
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021968726932100348110
  • Upwork Job ID: 1968726932100348110
  • Last Price Increase: 2025-09-25

Activity

  1. added
    DeployBlockerCash
    Daily
    Bug
    on Sep 12, 2025
  2. melvin-bot commented on Sep 12, 2025

    @melvin-bot

    Triggered auto assignment to @heyjennahay (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. melvin-bot commented on Sep 12, 2025

    @melvin-bot

    Triggered auto assignment to @aldo-expensify (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  4. melvin-bot commented on Sep 12, 2025

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  5. github-actions commented on Sep 12, 2025

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  6. neil-marcellini commented on Sep 12, 2025

    @neil-marcellini
    Contributor

    This only happens under a beta. It's not the deploy blocker.

  7. removed
    DeployBlockerCash
    Hourly
    on Sep 12, 2025
  8. 23 remaining items

  9. harjot20022001 commented on Sep 18, 2025

    @harjot20022001

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When a user creates a new expense report, the start date displayed in the report's title is sometimes incorrect, showing the previous day's date. This issue seems to be related to the user's timezone.

    What is the root cause of that problem?

    The root cause of this problem is that the report's creation date is being formatted using the user's local timezone. When a user is in a timezone that is behind UTC (e.g., in the Americas), creating a report late in their day can result in the UTC date being the next day. However, the current implementation formats this date back to the local timezone, which can incorrectly roll the date back to the previous day.

    What changes do you think we should make in order to solve the problem?

    To solve this, we should ensure that the report start date is always formatted in a consistent timezone, such as UTC. This will prevent discrepancies caused by the user's local timezone settings.

    I propose the following changes in src/libs/ReportUtils.ts:

    1. Import the formatInTimeZone function from the date-fns-tz library, which is already a project dependency.
    2. In the populateOptimisticReportFormula function, use formatInTimeZone to format the createdDate.

    Here is a code snippet of the proposed change:

    File: src/libs/ReportUtils.ts

    // Before
    .replaceAll(/\{report:startdate\}/gi, createdDate ? format(createdDate, CONST.DATE.FNS_FORMAT_STRING) : '')
    
    // After
    .replaceAll(/\{report:startdate\}/gi, createdDate ? formatInTimeZone(createdDate, 'UTC', CONST.DATE.FNS_FORMAT_STRING) : '')

    This will ensure the date is consistently formatted in UTC, resolving the issue.

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    To prevent regressions, we should add automated tests that cover the following scenarios:

    1. Timezone Behind UTC: Create a test case that simulates a user in a timezone behind UTC (e.g., 'America/Los_Angeles'). The test should create a report late in the evening (e.g., 10 PM PST) and verify that the report title shows the correct date, not the previous day.
    2. Timezone Ahead of UTC: Add a similar test for a user in a timezone ahead of UTC (e.g., 'Asia/Tokyo') to ensure the date is also handled correctly.
    3. Edge Case (Midnight UTC): A test case where a report is created exactly at or a few seconds after midnight UTC to confirm the date is correct.

    What alternative solutions did you explore? (Optional)

    One alternative solution I considered was to manually adjust the createdDate object by adding the timezone offset before formatting. However, this approach is more complex and prone to errors compared to using a well-tested library like date-fns-tz, which is designed to handle these timezone conversions reliably. The proposed solution is cleaner and more maintainable.

  10. suneox commented on Sep 23, 2025

    @suneox
    Contributor

    I lost track of this one and will review it later today

  11. melvin-bot commented on Sep 25, 2025

    @melvin-bot

    📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

  12. melvin-bot commented on Sep 26, 2025

    @melvin-bot

    @sosek108 @suneox @heyjennahay @aldo-expensify this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

  13. aldo-expensify commented on Sep 26, 2025

    @aldo-expensify
    Contributor

    Friendly bump @suneox

    Or maybe I have to check this first: #70474 (comment)

  14. melvin-bot commented on Sep 26, 2025

    @melvin-bot

    @suneox Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  15. aldo-expensify commented on Sep 27, 2025

    @aldo-expensify
    Contributor

    Didn't have time to get to this again, was working in more pressing stability issues and external commit

  16. mvtglobally commented on Sep 27, 2025

    @mvtglobally

    Issue not reproducible during KI retests. (First week)

  17. suneox commented on Sep 29, 2025

    @suneox
    Contributor

    I cannot reproduce this issue on the latest main, but I found another issue related to the report title: it shows ₫0 instead of ₫123 even when an expense is present while using VND.

    Image
  18. neil-marcellini commented on Sep 29, 2025

    @neil-marcellini
    Contributor

    Ok, please report that bug separately in Slack and we'll close this.

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

Metadata

Metadata

Labels

BugDailyEngineeringExternalHelp Wanted

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions