Skip to content

[$250] Status End Time Not Converted to Viewer’s Timezone in NewDot #70797

Closed

Description

@m-natarajan

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.15-9
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @allgandalf
Slack conversation (hyperlinked to channel name): #Expensify Bugs

Action Performed:

  1. User A sets a status with an end time in their timezone (e.g., 2:00 PM GST)
  2. User B (in a different timezone, e.g., IST) views User A’s status in DM
  3. Observe the displayed status end time.

Expected Result:

Status end time should be converted and displayed in the viewer’s timezone (e.g., 3:30 PM IST).

Actual Result:

Status end time is shown in the user’s original timezone (e.g., still 2:00 PM).

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
Image

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021976437754693463782
  • Upwork Job ID: 1976437754693463782
  • Last Price Increase: 2025-10-10
  • Automatic offers:
    • samranahm | Contributor | 109130053
Issue OwnerCurrent Issue Owner: @RachCHopkins

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Sep 18, 2025
  2. melvin-bot commented on Sep 18, 2025

    @melvin-bot

    Triggered auto assignment to @RachCHopkins (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. mukhrr commented on Sep 18, 2025

    @mukhrr
    Contributor

    Proposal

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

    Status End Time Not Converted to Viewer’s Timezone

    What is the root cause of that problem?

    We use DateUtils.getStatusUntilDate in ReportActionItemSingle for this tooltip:

    const formattedDate = DateUtils.getStatusUntilDate(details.status?.clearAfter ?? '');

    This is not taking timezone into account:

    App/src/libs/DateUtils.ts

    Lines 512 to 515 in 9fb00af

    /**
    * receive date like 2020-05-16 05:34:14 and format it to show in string like "Until 05:34 PM"
    */
    function getStatusUntilDate(inputDate: string): string {

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

    We can pass originalUserTimezone to getStatusUntilDate function to fix that:

    function getStatusUntilDate(
        inputDate: string,
        originalUserTimezone?: SelectedTimezone,
    ): ...

    And we will take care of timezone like this:

    App/src/libs/DateUtils.ts

    Lines 520 to 522 in e2e05b5

    const input = new Date(inputDate);
    const now = new Date();
    const endOfToday = endOfDay(now);

        const input = originalUserTimezone 
            ? toZonedTime(new Date(inputDate), originalUserTimezone)
            : new Date(inputDate);
        const now = originalUserTimezone 
            ? toZonedTime(new Date(), originalUserTimezone)
            : new Date();
        const endOfToday = endOfDay(now);

    And we can keep original logic in case we don't provide above timezones.

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

    We can add a test case into ReportActionItemSingle for that.

    What alternative solutions did you explore? (Optional)

  4. samranahm commented on Sep 18, 2025

    @samranahm
    Contributor

    Proposal

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

    Status End Time Not Converted to Viewer’s Timezone in NewDot

    What is the root cause of that problem?

    We are currently not converting the status clear after to current user's zoned time here

    App/src/libs/DateUtils.ts

    Lines 515 to 523 in 925b811

    function getStatusUntilDate(inputDate: string): string {
    if (!inputDate) {
    return '';
    }
    const input = new Date(inputDate);
    const now = new Date();
    const endOfToday = endOfDay(now);

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

    we should use toZonedTime to convert the clear after for current user's time zone

    App/src/libs/DateUtils.ts

    Lines 515 to 523 in 925b811

    function getStatusUntilDate(inputDate: string): string {
    if (!inputDate) {
    return '';
    }
    const input = new Date(inputDate);
    const now = new Date();
    const endOfToday = endOfDay(now);

    function getStatusUntilDate(inputDate: string, timezone: SelectedTimezone): string {
    if (!inputDate) {
        return '';
    }
    
    const input = toZonedTime(new Date(inputDate), timezone);
    const now = toZonedTime(new Date(), timezone);
    const endOfToday = endOfDay(now);

    and pass the timeZone in both places where we call getStatusUntilDate

    const formattedDate = DateUtils.getStatusUntilDate(details.status?.clearAfter ?? '');

      const formattedDate = DateUtils.getStatusUntilDate(details.status?.clearAfter ?? '', currentUserPersonalDetails?.timezone?.selected ?? CONST.DEFAULT_TIME_ZONE.selected);

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

    We should add the unit test for getStatusUntilDate to ensure it correctly formats dates according to different time zones and all other cases, such as today, tomorrow, later this year, and dates in another year.

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  5. samranahm commented on Sep 18, 2025

    @samranahm
    Contributor
  6. bernhardoj commented on Sep 18, 2025

    @bernhardoj
    Contributor

    Proposal

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

    Status end time is not converted to the user time zone.

    What is the root cause of that problem?

    Currently, we just format and show the date, which is in the user's timezone. For example, if the user's timezone is UTC+8, then inputDate will be in UTC+8.

    App/src/libs/DateUtils.ts

    Lines 512 to 541 in 8e075c2

    /**
    * receive date like 2020-05-16 05:34:14 and format it to show in string like "Until 05:34 PM"
    */
    function getStatusUntilDate(inputDate: string): string {
    if (!inputDate) {
    return '';
    }
    const input = new Date(inputDate);
    const now = new Date();
    const endOfToday = endOfDay(now);
    // If the date is adjusted to the following day
    if (isSameSecond(input, endOfToday)) {
    return translateLocal('statusPage.untilTomorrow');
    }
    // If it's a time on the same date
    if (isSameDay(input, now)) {
    return translateLocal('statusPage.untilTime', {time: format(input, CONST.DATE.LOCAL_TIME_FORMAT)});
    }
    // If it's further in the future than tomorrow but within the same year
    if (isAfter(input, now) && isSameYear(input, now)) {
    return translateLocal('statusPage.untilTime', {time: format(input, `${CONST.DATE.SHORT_DATE_FORMAT} ${CONST.DATE.LOCAL_TIME_FORMAT}`)});
    }
    // If it's in another year
    return translateLocal('statusPage.untilTime', {time: format(input, `${CONST.DATE.FNS_FORMAT_STRING} ${CONST.DATE.LOCAL_TIME_FORMAT}`)});
    }

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

    First, we need to convert the time to UTC+0 first, and then convert it back to the current user selected timezone.

    const input = toZonedTime(fromZonedTime(new Date(inputDate), actorTimezone), currentUserTimezone);
    const now = toZonedTime(new Date(), currentUserTimezone);
    

    We can get the actorTimezone from the personal details.

    const formattedDate = DateUtils.getStatusUntilDate(details.status?.clearAfter ?? '');

    details.timezone?.selected
    

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

    We can test getStatusUntilDate given action actor timezone is different from the current user timezone and verify the date is converted to the current user timezone.

  7. RachCHopkins commented on Sep 22, 2025

    @RachCHopkins
    Contributor

    I'm not getting this issue on MacOS or Mac Chrome.

    Maybe a retest is needed.

  8. added
    retest-weeklyApply this label if you want this issue tested on a Weekly basis by Applause
    on Sep 22, 2025
  9. IuliiaHerets commented on Sep 22, 2025

    @IuliiaHerets

    QA team can't repro this issue on Windows 10/Chrome/Build v9.2.16-2

    2025-09-22.14-04-22.mp4
  10. allgandalf commented on Sep 22, 2025

    @allgandalf
    Contributor

    @IuliiaHerets note that you need to be on a different timezone in the other account for eg, the user who sets status should be in dubai timezone and another user who sees it is in IST

  11. samranahm commented on Sep 22, 2025

    @samranahm
    Contributor

    @allgandalf, can you send me a message on this Expensify account (samranahmed03@gmail.com) after setting a status end time for 30 minutes later?

  12. RachCHopkins commented on Sep 23, 2025

    @RachCHopkins
    Contributor

    @allgandalf can you repro this? I tried with a user account in AEST and mine in NZST and could not repro.

  13. 48 remaining items

  14. melvin-bot commented on Nov 12, 2025

    @melvin-bot

    This issue has not been updated in over 15 days. @tgolen, @rushatgabhane, @RachCHopkins, @samranahm eroding to Monthly issue.

    P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

  15. samranahm commented on Nov 13, 2025

    @samranahm
    Contributor

    @RachCHopkins gentle bump.

  16. RachCHopkins commented on Nov 16, 2025

    @RachCHopkins
    Contributor

    Looks like automation is borked. Manually fixing all the things.

  17. RachCHopkins commented on Nov 16, 2025

    @RachCHopkins
    Contributor

    Payment Summary:

    • Contributor: @samranahm to be paid $250 via Upwork
    • Contributor+: @rushatgabhane to be paid $250 via NewDot manual request

    Upwork job here

  18. RachCHopkins commented on Nov 16, 2025

    @RachCHopkins
    Contributor

    @rushatgabhane do we need a regression test?

  19. RachCHopkins commented on Nov 16, 2025

    @RachCHopkins
    Contributor

    Contributor has been paid, the contract has been completed, and the Upwork post has been closed.

    🟢 to @rushatgabhane to request payment.

  20. rushatgabhane commented on Nov 24, 2025

    @rushatgabhane
    Member

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: Been a bug since the start. Can't pinpoint a PR

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: Not critical

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    Regression Test Proposal Template

    Regression Test Proposal

    Test:

    Preconditions:

    -Have a device in a different timezone, e.g., California [User A]

    User A (California) 10:00 AM (PDT)
    User B (Netherlands) 7:00 PM (CEST)

    1. [User A] Set a status until time 30 minutes
    2. [User A] Send a DM to User B
    3. [User B] open the dm and verify status shown next to user's display name
    4. [User B] Hover over status emoji in report action message and LHN
    5. [User B] Verify the status until time is "Until 7:30 PM" with respect to their own time zone CEST

    Do we agree 👍 or 👎

  21. rushatgabhane commented on Nov 25, 2025

    @rushatgabhane
    Member

    not overdue

  22. trjExpensify commented on Dec 5, 2025

    @trjExpensify
    Contributor

    approved $250 for @rushatgabhane

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions