Skip to content

[Due for payment 2025-07-01] [$250] Date field is incorrectly mapped as Initial Value when creating report fields and in the edit page as well for date field #64428

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.1.68-3
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. Create a Workspace
  2. Go to reports > Click Add Field
  3. Enter any name > Select type as Date

Expected Result:

As seen in OldDot, the 3rd row should have a heading as Initial Value like other fields List and Name and the value should be Current Date

Actual Result:

We see the that the heading is incorrectly shown as Date and the value is shown as Initial Value

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

Recording.1299.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021935301768696082784
  • Upwork Job ID: 1935301768696082784
  • Last Price Increase: 2025-06-18
  • Automatic offers:
    • allgandalf | Contributor | 107741402
Issue OwnerCurrent Issue Owner: @VictoriaExpensify

Activity

  1. added
    Daily
    Bug
    on Jun 18, 2025
  2. melvin-bot commented on Jun 18, 2025

    @melvin-bot

    Triggered auto assignment to @VictoriaExpensify (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. m-natarajan commented on Jun 18, 2025

    @m-natarajan
    Author

    Proposal by @allgandalf

    Proposal

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

    Date field is incorrectly mapped as Initial Value when creating report fields and in the edit page for date field.

    What is the root cause of that problem?

    We incorrectly show the title and description when the field is Date in report fields, instead of the Initial Value title, we show Date as title and shown Initial Value as the value present:

    {inputValues[INPUT_IDS.TYPE] === CONST.REPORT_FIELD_TYPES.DATE && (
    <MenuItemWithTopDescription
    title={translate('common.initialValue')}
    description={translate('common.date')}

    Also when we are editing the report Field, we set the default value for the date field as Initial Value which is wrong:

    if (reportField.type === CONST.REPORT_FIELD_TYPES.DATE) {
    return Localize.translateLocal('common.initialValue');
    }

    Both of these cause a visual difference and confusion, we have the correct representation on OldDot:

    Image

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

    To fix these we need to update 3 files almost.

    1. Update WorkspaceReportFieldUtils to return the correct values for the date field:

    function getReportFieldInitialValue(reportField: PolicyReportField | null): string {

        if (reportField.type === CONST.REPORT_FIELD_TYPES.DATE) {
            return Localize.translateLocal('common.currentDate');
     }
    1. Update WorkspaceCreateReportFieldsPage to shown the correct values for date field:

    {inputValues[INPUT_IDS.TYPE] === CONST.REPORT_FIELD_TYPES.DATE && (
    <MenuItemWithTopDescription
    title={translate('common.initialValue')}
    description={translate('common.date')}
    rightLabel={translate('common.required')}

                                {inputValues[INPUT_IDS.TYPE] === CONST.REPORT_FIELD_TYPES.DATE && (
                                    <MenuItemWithTopDescription
                                        title={translate('common.currentDate')}
                                        description={translate('common.initialValue')}
    1. Update ReportFieldsSettingsPage to shown the correct description:

    Update if there are any more places for dates

    {!isListFieldEmpty && (
    <MenuItemWithTopDescription
    style={[styles.moneyRequestMenuItem]}
    titleStyle={styles.flex1}
    title={WorkspaceReportFieldUtils.getReportFieldInitialValue(reportField)}
    description={isDateFieldType ? translate('common.date') : translate('common.initialValue')}

                        {!isListFieldEmpty && (
                            <MenuItemWithTopDescription
                                style={[styles.moneyRequestMenuItem]}
                                titleStyle={styles.flex1}
                                title={WorkspaceReportFieldUtils.getReportFieldInitialValue(reportField)}
                                description={translate('common.initialValue')}
    
    

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

    N/A, this is a UI bug but we can always have UI test to see if the values are shown correctly, but this is not required for this case

    What alternative solutions did you explore? (Optional)

    N/A

  4. allgandalf commented on Jun 18, 2025

    @allgandalf
    Contributor

    @VictoriaExpensify Here's the correct format from OldDot:

    Image

    Can you make this issue external please

  5. VictoriaExpensify commented on Jun 18, 2025

    @VictoriaExpensify
    Contributor
  6. added
    External
    on Jun 18, 2025
  7. changed the title [-]Date field is incorrectly mapped as Initial Value when creating report fields and in the edit page as well for date field[/-] [+][$250] Date field is incorrectly mapped as Initial Value when creating report fields and in the edit page as well for date field[/+] on Jun 18, 2025
  8. melvin-bot commented on Jun 18, 2025

    @melvin-bot
  9. added
    Help Wanted
    on Jun 18, 2025
  10. melvin-bot commented on Jun 18, 2025

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @ZhenjaHorbach (External)

  11. DmitryChizhevsky-vs commented on Jun 18, 2025

    @DmitryChizhevsky-vs

    Problem

    When creating or viewing a report field of type Date, the UI incorrectly shows:

    1. The heading "Date" instead of "Initial Value"
    2. The value "Initial Value" instead of the actual date value

    This happens in two places:

    1. In the Create Report Fields page (CreateReportFieldsPage.tsx)
    2. In the Report Fields Settings page (ReportFieldsSettingsPage.tsx)

    Root Cause

    The issue is in the MenuItemWithTopDescription component in CreateReportFieldsPage.tsx (lines 185-191). The component has the title and description parameters swapped:

    {inputValues[INPUT_IDS.TYPE] === CONST.REPORT_FIELD_TYPES.DATE && (
        <MenuItemWithTopDescription
            title={translate('common.initialValue')}
            description={translate('common.date')}
            rightLabel={translate('common.required')}
            interactive={false}
        />
    )}

    The title should be the value displayed in the main text area, and description should be the label above it. However, they're reversed from what they should be.

    Similarly, in ReportFieldsSettingsPage.tsx (lines 110-118), there's a similar issue:

    <MenuItemWithTopDescription
        style={[styles.moneyRequestMenuItem]}
        titleStyle={styles.flex1}
        title={WorkspaceReportFieldUtils.getReportFieldInitialValue(reportField)}
        description={isDateFieldType ? translate('common.date') : translate('common.initialValue')}
        shouldShowRightIcon={!isDateFieldType && !hasAccountingConnections}
        interactive={!isDateFieldType && !hasAccountingConnections}
        onPress={() => Navigation.navigate(ROUTES.WORKSPACE_EDIT_REPORT_FIELDS_INITIAL_VALUE.getRoute(policyID, reportFieldID))}
    />

    Here, when isDateFieldType is true, the description is set to 'common.date' instead of 'common.initialValue'.

    Proposed Solution

    1. Fix the MenuItemWithTopDescription in CreateReportFieldsPage.tsx:
    {inputValues[INPUT_IDS.TYPE] === CONST.REPORT_FIELD_TYPES.DATE && (
        <MenuItemWithTopDescription
            title={defaultDate} // Show the actual default date
            description={translate('common.initialValue')} // Show "Initial Value" as the label
            rightLabel={translate('common.required')}
            interactive={false}
        />
    )}
    1. Fix the MenuItemWithTopDescription in ReportFieldsSettingsPage.tsx:
    <MenuItemWithTopDescription
        style={[styles.moneyRequestMenuItem]}
        titleStyle={styles.flex1}
        title={WorkspaceReportFieldUtils.getReportFieldInitialValue(reportField)}
        description={translate('common.initialValue')} // Always show "Initial Value" as the label
        shouldShowRightIcon={!isDateFieldType && !hasAccountingConnections}
        interactive={!isDateFieldType && !hasAccountingConnections}
        onPress={() => Navigation.navigate(ROUTES.WORKSPACE_EDIT_REPORT_FIELDS_INITIAL_VALUE.getRoute(policyID, reportFieldID))}
    />
    1. Fix the getReportFieldInitialValue function in WorkspaceReportFieldUtils.ts to return the actual date value for date fields instead of the string "Initial Value":
    if (reportField.type === CONST.REPORT_FIELD_TYPES.DATE) {
        return reportField.value ?? reportField.defaultValue ?? '';
    }

    These changes will ensure that:

    1. The label consistently shows "Initial Value" for all field types
    2. The actual date value is displayed for date fields instead of showing "Initial Value"
    3. The UI matches the expected behavior as described in the issue

    This solution addresses the inconsistency in both the create and edit pages for report fields, ensuring a consistent user experience across the application.

  12. 12 remaining items

  13. added
    Awaiting Payment
    on Jun 24, 2025
  14. changed the title [-][$250] Date field is incorrectly mapped as Initial Value when creating report fields and in the edit page as well for date field[/-] [+][Due for payment 2025-07-01] [$250] Date field is incorrectly mapped as Initial Value when creating report fields and in the edit page as well for date field[/+] on Jun 24, 2025
  15. removed
    Reviewing
    on Jun 24, 2025
  16. melvin-bot commented on Jun 24, 2025

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  17. melvin-bot commented on Jun 24, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.70-7 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2025-07-01. 🎊

    For reference, here are some details about the assignees on this issue:

  18. melvin-bot commented on Jun 24, 2025

    @melvin-bot

    @ZhenjaHorbach / @allgandalf @VictoriaExpensify @ZhenjaHorbach / @allgandalf The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  19. allgandalf commented on Jun 25, 2025

    @allgandalf
    Contributor

    @ZhenjaHorbach will fill the checklist

  20. added
    Daily
    and removed
    Weekly
    on Jul 1, 2025
  21. VictoriaExpensify commented on Jul 2, 2025

    @VictoriaExpensify
    Contributor

    Payment Summary:
    C: @allgandalf paid $250 via Upwork
    C+: @ZhenjaHorbach pwed $250 via NewDot

  22. ZhenjaHorbach commented on Jul 2, 2025

    @ZhenjaHorbach
    Contributor

    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.

      It's more of a new feature

    • [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: NA

    • [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.

    I'm not sure if tests are needed here
    Since this is a UI bug

  23. ZhenjaHorbach commented on Jul 2, 2025

    @ZhenjaHorbach
    Contributor

    Requested in ND !

  24. garrettmknight commented on Jul 21, 2025

    @garrettmknight
    Contributor

    $250 approved for @ZhenjaHorbach

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

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions