Skip to content

[$175] Rail trip date does not include a year in the trip room/ rail details #106263

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.5.33-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #105863
Email or phone of affected tester (no customers): applausetester+ii_1905@applause.expensifail.com
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: MacBook Air 26.6.2 Chrome, iPhone 15 iOS 26.6.1
App Component: Money Requests

Action Performed:

Preconditions: as an expensifail account with the Travel enabled in the workspace, book a railroad one way trip

  1. Go to the workspace chat, open the trip room
  2. Open the trip details with the header "Rail details"
  3. Observe the Date field

Expected Result:

The date in the Rail details looks like Monday, December 14, 2026

Actual Result:

The date in the Rail Details looks like Monday, Dec 14

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome Safari

Screenshots/Videos

Bug7307159_1793994314603.Rail_trip_date.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Chandana Kiran
Bug ID: 7307159

Upwork Automation - Do Not Edit

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Nov 6, 2026
  2. applause-bot commented on Nov 6, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/585709df890976864774ea121b7397e55ca7212e9bdd93213284c2ae838459f1

  3. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Nov 6, 2026
  4. melvin-bot commented on Nov 6, 2026

    @melvin-bot

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

  5. changed the title [-]Rail trip date does not include a year in the trip room/ rail details[/-] [+][$175] Rail trip date does not include a year in the trip room/ rail details[/+] on Nov 6, 2026
  6. melvin-bot commented on Nov 6, 2026

    @melvin-bot
  7. MelvinBot commented on Nov 6, 2026

    @MelvinBot
    Contributor

    🤖 Web test steps verification results: ⚠️ partial

    The test account shows “No workspaces yet,” so no Travel-enabled workspace or booked rail trip was available. No bookings or fixtures were created.

    Workspaces page showing No workspaces yet

    Step Status
    Open workspace chat and trip roomBlocked: account has no workspaces.
    Workspaces page showing No workspaces yet
    ⚠️
    Open “Rail details”Required workspace and booked trip are unavailable.
    ⚠️
    Verify full month and yearRail details could not be reached; live reproduction remains unverified.
    ⚠️

    Proposal

    Confidence: Medium — source code explains the reported output; live verification was blocked.

    What is the root cause of that problem?

    Rail details uses a compact transport-date formatter. For current-year trips, it explicitly selects EEEE, MMM d, producing Monday, Dec 14. Other-year dates include the year but still abbreviate the month.

    Code evidence and alternatives checked

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

    Use the existing full-date formatter for the Rail details Date field only. Keep departure and arrival time formatting unchanged.

    Add regression coverage for current-year and other-year departures, localized date ordering, and unchanged departure/arrival times.

    What alternative solutions did you explore? (Optional)

    Changing the shared transport formatter would unnecessarily affect other trip types and contradict its existing compact-format tests. A rail-specific change is safer.


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/106263) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.


    view run

  8. vanshshah11 commented on Nov 6, 2026

    @vanshshah11

    Proposal for Issue #106263 — Rail trip date does not include a year in the trip room/rail details ($175)

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

    In the Rail details trip page, the Date field shows "Monday, Dec 14" (abbreviated month, no year) instead of the expected "Monday, December 14, 2026" (full month name with year).

    Root cause

    src/pages/Travel/TrainTripDetails.tsx line 32 calls DateUtils.getFormattedTransportDateAndHour() for the date display, then uses .date on line 51 for the Date field value.

    getFormattedTransportDateAndHour() (DateUtils.ts line 930–944) formats the date as 'EEEE, MMM d' when isThisYear(date) is true — producing "Monday, Dec 14" for any trip in the current year. This is appropriate for the departure/arrival time fields (which use .hour), but the standalone Date field should show the full long-date-with-weekday format including the year.

    For comparison, the trip summary view in TripDetailsView.tsx (line 79, default case for TRAIN) correctly uses DateUtils.formatToLongDateWithWeekday() which returns 'eeee, MMMM d, yyyy' = "Monday, December 14, 2026". The TrainTripDetails page should be consistent with this.

    Fix

    In TrainTripDetails.tsx, use DateUtils.formatToLongDateWithWeekday() for the Date field value instead of getFormattedTransportDateAndHour().date. Keep getFormattedTransportDateAndHour() for .hour since the departure/arrival time fields only need the time portion.

    Specifically:

    • Line 51: change value={startDate.date} to value={DateUtils.formatToLongDateWithWeekday(new Date(reservation.start.date), dateFnsLocale)}

    This is a one-line change, consistent with how TripDetailsView.tsx already formats TRAIN dates in its default branch.

    Test plan

    1. Book a rail trip (or use a test reservation with type 'train')
    2. Open the trip room → Rail details
    3. Verify the Date field shows full month name + year (e.g., "Monday, December 14, 2026")
    4. Verify departure and arrival times still display correctly
    5. Verify a trip booked for next year also shows the year correctly (formatToLongDateWithWeekday always includes year)
  9. zaidrain06 commented on Nov 6, 2026

    @zaidrain06

    Proposal

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

    When viewing a booked Rail trip in the trip room or opening Rail details, the Date field renders in the abbreviated transport format without the year (e.g., Monday, Dec 14 for current-year trips, or Monday, Dec 14, 2027 with an abbreviated month for future years) instead of the full localized long date with weekday and year (Monday, December 14, 2026). Additionally, unlike FlightTripDetails, the Date field in TrainTripDetails is missing the <MenuItem.Copy> child control.

    What is the root cause of that problem?

    1. In src/pages/Travel/TrainTripDetails.tsx:32-53, TrainTripDetails computes startDate using DateUtils.getFormattedTransportDateAndHour(new Date(reservation.start.date), dateFnsLocale) and passes startDate.date directly to the Date MenuItemField:
      const startDate = DateUtils.getFormattedTransportDateAndHour(new Date(reservation.start.date), dateFnsLocale);
      ...
      <MenuItemField
          name={translate('common.date')}
          value={startDate.date}
      />
    2. In src/libs/DateUtils.ts:967-981, getFormattedTransportDateAndHour explicitly branches on isThisYear(date) and formats date with 'EEEE, MMM d' (omitting the year completely when isThisYear(date) is true, and using the abbreviated month MMM in all cases).
    3. By contrast, the trip room summary in src/components/ReportActionItem/TripDetailsView.tsx:71-80 falls into the default case for CONST.RESERVATION_TYPE.TRAIN and uses DateUtils.formatToLongDateWithWeekday(new Date(reservation.start.date), dateFnsLocale), which uses Intl.DateTimeFormat(localeCode, {weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', timeZone: 'UTC'}) on toUTCWallClockDate(date) to render the full localized weekday, full month name, day, and 4-digit year (Monday, December 14, 2026).

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

    In src/pages/Travel/TrainTripDetails.tsx, format the standalone Rail Date field using DateUtils.formatToLongDateWithWeekday(new Date(reservation.start.date), dateFnsLocale) (matching TripDetailsView.tsx) while keeping startDate.hour and endDate.hour from getFormattedTransportDateAndHour for the Departs and Arrives time fields:

        const startDate = DateUtils.getFormattedTransportDateAndHour(new Date(reservation.start.date), dateFnsLocale);
        const endDate = DateUtils.getFormattedTransportDateAndHour(new Date(reservation.end.date), dateFnsLocale);
        const formattedStartDate = DateUtils.formatToLongDateWithWeekday(new Date(reservation.start.date), dateFnsLocale);

    And update the Date MenuItemField in src/pages/Travel/TrainTripDetails.tsx:49-53:

                <MenuItemField
                    name={translate('common.date')}
                    value={formattedStartDate}
                >
                    {!!formattedStartDate && <MenuItem.Copy value={formattedStartDate} />}
                </MenuItemField>

    What alternative solutions did you explore? (Optional)

    Modifying DateUtils.getFormattedTransportDateAndHour() directly was ruled out because FlightTripDetails and existing unit tests in tests/unit/DateUtilsTest.ts rely on its compact format, and changing it globally would alter flight date formatting across the app.

  10. melvin-bot commented on Nov 6, 2026

    @melvin-bot

    📣 @zaidrain06! 📣
    Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
    Please follow these steps:

    1. Make sure you've read and understood the contributing guidelines.
    2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
    3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
    4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
      Screen Shot 2022-11-16 at 4 42 54 PM
      Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
    
  11. zaidrain06 commented on Nov 6, 2026

    @zaidrain06

    Contributor details
    Your Expensify account email: bydelibozok@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~01c95ae76603189dc9

  12. melvin-bot commented on Nov 6, 2026

    @melvin-bot

    ⚠️ Invalid email. Please make sure to create an Expensify account with this email first here.

  13. 16 remaining items

  14. ZhenjaHorbach commented on Nov 10, 2026

    @ZhenjaHorbach
    Contributor

    Will check the issue today or tomorrow

  15. jmquero92 commented on Nov 11, 2026

    @jmquero92

    Proposal

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

    In the workspace chat trip room, when opening a booked railroad trip and inspecting the "Rail details" page, the Date field displays as "Monday, Dec 14" (abbreviating the month and omitting the year) instead of the expected full localized format "Monday, December 14, 2026".

    What is the root cause of that problem?

    In src/pages/Travel/TrainTripDetails.tsx (lines 34–52):

    const startDate = DateUtils.getFormattedTransportDateAndHour(new Date(reservation.start.date), dateFnsLocale);
    const endDate = DateUtils.getFormattedTransportDateAndHour(new Date(reservation.end.date), dateFnsLocale);
    ...
    <MenuItemField
        name={translate('common.date')}
        value={startDate.date}
    />
    1. startDate.date is generated by DateUtils.getFormattedTransportDateAndHour (src/libs/DateUtils.ts:1013-1027):
    if (isThisYear(date)) {
        return {
            date: formatToWeekdayDate(date, dateFnsLocale, false),
            hour: format(date, CONST.DATE.LOCAL_TIME_FORMAT, {locale: dateFnsLocale}),
        };
    }
    1. For dates within the current year (isThisYear(date)), formatToWeekdayDate is called with shouldIncludeYear = false, which uses memoizedCreateWeekdayDateFormatter configured with {weekday: 'long', month: 'short', day: 'numeric', year: undefined}. This results in the abbreviated format Monday, Dec 14.
    2. While the compact startDate.hour / endDate.hour format is appropriate for departure/arrival times, the standalone Date field in trip reservations is intended to display the full localized long date with weekday, full month name, day, and 4-digit year (consistent with TripDetailsView.tsx:79, which uses DateUtils.formatToLongDateWithWeekday).
    3. Additionally, TrainTripDetails.tsx is missing <MenuItem.Copy value={...} /> inside the Date <MenuItemField>, unlike FlightTripDetails.tsx:89.

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

    1. In src/pages/Travel/TrainTripDetails.tsx:
      Replace startDate.date with DateUtils.formatToLongDateWithWeekday(new Date(reservation.start.date), dateFnsLocale), and add <MenuItem.Copy>:
    --- a/src/pages/Travel/TrainTripDetails.tsx
    +++ b/src/pages/Travel/TrainTripDetails.tsx
    @@ -48,8 +48,10 @@ function TrainTripDetails({reservation, personalDetails}: TrainTripDetailsProps)
                 </MenuItemField>
                 <MenuItemField
                     name={translate('common.date')}
    -                value={startDate.date}
    -            />
    +                value={DateUtils.formatToLongDateWithWeekday(new Date(reservation.start.date), dateFnsLocale)}
    +            >
    +                <MenuItem.Copy value={DateUtils.formatToLongDateWithWeekday(new Date(reservation.start.date), dateFnsLocale)} />
    +            </MenuItemField>
    
                 <MenuItem.Root>
    1. Keep DateUtils.getFormattedTransportDateAndHour unchanged for startDate.hour and endDate.hour on the travel.trainDetails.departs and travel.trainDetails.arrives rows, preserving localized time formatting.

    What alternative solutions did you explore? (Optional)

    Modifying DateUtils.getFormattedTransportDateAndHour directly was explored and rejected, because getFormattedTransportDateAndHour is a shared transport utility used by FlightTripDetails.tsx, HotelTripDetails.tsx, and CarTripDetails.tsx (e.g. CarTripDetails.tsx:51, where {pickUpDate.date} • {pickUpDate.hour} is rendered in a compact single-line layout). Changing the shared function would regress existing compact layouts and contradict established unit tests. Using DateUtils.formatToLongDateWithWeekday directly in TrainTripDetails.tsx is completely isolated, safe, and aligns with TripDetailsView.tsx:79.

    What automated tests can you add to prevent this from re-occurring?

    In tests/unit/DateUtilsTest.ts:
    Verify that DateUtils.formatToLongDateWithWeekday always returns weekday, full month name, day, and 4-digit year for both current-year and future-year dates across supported locales (en, es).

  16. ZhenjaHorbach commented on Nov 11, 2026

    @ZhenjaHorbach
    Contributor

    Not sure if it's a real bug
    This format has existed since #52823, and #105863 didn't touch TrainTripDetails
    Flight, Hotel, and Car details use the same format, so it looks intentional. Changing only Rail would make it inconsistent
    Or we can update all these places

    CC: @Expensify/design

  17. jmquero92 commented on Nov 11, 2026

    @jmquero92

    Thanks for checking @ZhenjaHorbach! That makes total sense. Standardizing the date format (and copy action) across all travel components (TrainTripDetails, FlightTripDetails, HotelTripDetails, and CarTripDetails) would provide a much more consistent UX across the whole Travel suite. My proposal easily extends to update all 4 places cleanly without regressions. Happy to implement the unified update across all of them if @Expensify/design gives the green light!

  18. ZhenjaHorbach commented on Nov 11, 2026

    @ZhenjaHorbach
    Contributor

    Proposals without Help wanted label are ignored
    Please read the guides

  19. dannymcclain commented on Nov 11, 2026

    @dannymcclain
    Contributor

    I think this format, Monday, Dec 14, is what we want. I'd only expect to see the year if it wasn't the current year, and even then, I'd still expect the shorter month (i.e. Monday, Dec 14, 2027). @Expensify/design for a gut check there though.

  20. shawnborton commented on Nov 11, 2026

    @shawnborton
    Contributor

    That checks out to me 👍

  21. dubielzyk-expensify commented on Nov 11, 2026

    @dubielzyk-expensify
    Contributor

    Makes sense to me too 👍

  22. ZhenjaHorbach commented on Nov 13, 2026

    @ZhenjaHorbach
    Contributor

    Okay then
    Thanks for your thoughts!
    Let's close this!

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

Metadata

Metadata

Assignees

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