From bacc21475b31a1446f67d9c17ef984d63813a5e4 Mon Sep 17 00:00:00 2001
From: Carlos Miceli <carlosmiceli@expensify.com>
Date: Tue, 17 Feb 2026 16:00:08 -0300
Subject: [PATCH 1/5] add util method

---
 src/libs/CardUtils.ts | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/libs/CardUtils.ts b/src/libs/CardUtils.ts
index 0c2d5ff3921e..c91573e417f5 100644
--- a/src/libs/CardUtils.ts
+++ b/src/libs/CardUtils.ts
@@ -840,6 +840,22 @@ function getDefaultCardName(cardholder?: string) {
     return `${cardholder}'s card`;
 }
 
+/**
+ * Gets the date option for a card assignment.
+ * When not editing, always returns CUSTOM option.
+ * When editing, returns the existing date option or CUSTOM as fallback.
+ *
+ * @param isEditing - Whether the card assignment is being edited
+ * @param existingDateOption - The existing date option from previous assignment
+ * @returns Date option constant
+ */
+function getCardAssignmentDateOption(
+    isEditing: boolean | undefined,
+    existingDateOption?: ValueOf<typeof CONST.COMPANY_CARD.TRANSACTION_START_DATE_OPTIONS>,
+): ValueOf<typeof CONST.COMPANY_CARD.TRANSACTION_START_DATE_OPTIONS> {
+    return isEditing ? (existingDateOption ?? CONST.COMPANY_CARD.TRANSACTION_START_DATE_OPTIONS.CUSTOM) : CONST.COMPANY_CARD.TRANSACTION_START_DATE_OPTIONS.CUSTOM;
+}
+
 function checkIfNewFeedConnected(prevFeedsData: CompanyFeeds, currentFeedsData: CompanyFeeds, plaidBank?: string) {
     const prevFeeds = Object.keys(prevFeedsData);
     const currentFeeds = Object.keys(currentFeedsData);
@@ -1196,6 +1212,7 @@ export {
     hasOnlyOneCardToAssign,
     checkIfNewFeedConnected,
     getDefaultCardName,
+    getCardAssignmentDateOption,
     getDomainOrWorkspaceAccountID,
     mergeCardListWithWorkspaceFeeds,
     isCard,

From 82274152e43e03fe8b18a19ed19806474eaa7843 Mon Sep 17 00:00:00 2001
From: Carlos Miceli <carlosmiceli@expensify.com>
Date: Tue, 17 Feb 2026 16:00:29 -0300
Subject: [PATCH 2/5] use util method in asignee step

---
 .../workspace/companyCards/assignCard/AssigneeStep.tsx | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/pages/workspace/companyCards/assignCard/AssigneeStep.tsx b/src/pages/workspace/companyCards/assignCard/AssigneeStep.tsx
index 646c17b2a04b..ba13fb6038c5 100644
--- a/src/pages/workspace/companyCards/assignCard/AssigneeStep.tsx
+++ b/src/pages/workspace/companyCards/assignCard/AssigneeStep.tsx
@@ -16,7 +16,7 @@ import useSearchSelector from '@hooks/useSearchSelector';
 import useThemeStyles from '@hooks/useThemeStyles';
 import {setDraftInviteAccountID} from '@libs/actions/Card';
 import {searchInServer} from '@libs/actions/Report';
-import {getDefaultCardName} from '@libs/CardUtils';
+import {getCardAssignmentDateOption, getDefaultCardName} from '@libs/CardUtils';
 import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
 import type {SettingsNavigatorParamList} from '@libs/Navigation/types';
 import {getHeaderMessage, getSearchValueForPhoneOrEmail, sortAlphabetically} from '@libs/OptionsListUtils';
@@ -95,9 +95,7 @@ function AssigneeStep({route}: AssigneeStepProps) {
                 cardToAssign.startDate = !isEditing
                     ? format(new Date(), CONST.DATE.FNS_FORMAT_STRING)
                     : (assignCard?.cardToAssign?.startDate ?? format(new Date(), CONST.DATE.FNS_FORMAT_STRING));
-                cardToAssign.dateOption = !isEditing
-                    ? CONST.COMPANY_CARD.TRANSACTION_START_DATE_OPTIONS.CUSTOM
-                    : (assignCard?.cardToAssign?.dateOption ?? CONST.COMPANY_CARD.TRANSACTION_START_DATE_OPTIONS.CUSTOM);
+                cardToAssign.dateOption = getCardAssignmentDateOption(isEditing, assignCard?.cardToAssign?.dateOption);
                 setAssignCardStepAndData({
                     cardToAssign,
                     isEditing: false,
@@ -132,9 +130,7 @@ function AssigneeStep({route}: AssigneeStepProps) {
             cardToAssign.startDate = !isEditing
                 ? format(new Date(), CONST.DATE.FNS_FORMAT_STRING)
                 : (assignCard?.cardToAssign?.startDate ?? format(new Date(), CONST.DATE.FNS_FORMAT_STRING));
-            cardToAssign.dateOption = !isEditing
-                ? CONST.COMPANY_CARD.TRANSACTION_START_DATE_OPTIONS.CUSTOM
-                : (assignCard?.cardToAssign?.dateOption ?? CONST.COMPANY_CARD.TRANSACTION_START_DATE_OPTIONS.CUSTOM);
+            cardToAssign.dateOption = getCardAssignmentDateOption(isEditing, assignCard?.cardToAssign?.dateOption);
             setAssignCardStepAndData({
                 cardToAssign,
                 isEditing: false,

From 19ec54a61b0789bd440b9199d9294768abda0ac8 Mon Sep 17 00:00:00 2001
From: Carlos Miceli <carlosmiceli@expensify.com>
Date: Tue, 17 Feb 2026 16:00:40 -0300
Subject: [PATCH 3/5] use util method in new member step

---
 .../companyCards/assignCard/InviteNewMemberStep.tsx         | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/pages/workspace/companyCards/assignCard/InviteNewMemberStep.tsx b/src/pages/workspace/companyCards/assignCard/InviteNewMemberStep.tsx
index 6494fd2a0c5d..c9ae55eeb010 100644
--- a/src/pages/workspace/companyCards/assignCard/InviteNewMemberStep.tsx
+++ b/src/pages/workspace/companyCards/assignCard/InviteNewMemberStep.tsx
@@ -7,7 +7,7 @@ import useCardsList from '@hooks/useCardsList';
 import useLocalize from '@hooks/useLocalize';
 import useOnyx from '@hooks/useOnyx';
 import {setDraftInviteAccountID} from '@libs/actions/Card';
-import {getDefaultCardName, getFilteredCardList, hasOnlyOneCardToAssign} from '@libs/CardUtils';
+import {getCardAssignmentDateOption, getDefaultCardName, getFilteredCardList, hasOnlyOneCardToAssign} from '@libs/CardUtils';
 import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
 import type {SettingsNavigatorParamList} from '@libs/Navigation/types';
 import Navigation from '@navigation/Navigation';
@@ -64,7 +64,7 @@ function InviteNewMemberStep({route, currentUserPersonalDetails}: InviteeNewMemb
             cardToAssign.cardName = assignCard.cardToAssign.cardName;
             cardToAssign.customCardName = assignCard.cardToAssign.customCardName ?? defaultCardName;
             cardToAssign.startDate = assignCard?.cardToAssign?.startDate ?? new Date().toISOString().split('T').at(0);
-            cardToAssign.dateOption = assignCard?.cardToAssign?.dateOption ?? CONST.COMPANY_CARD.TRANSACTION_START_DATE_OPTIONS.CUSTOM;
+            cardToAssign.dateOption = getCardAssignmentDateOption(true, assignCard?.cardToAssign?.dateOption);
             setAssignCardStepAndData({
                 currentStep: CONST.COMPANY_CARD.STEP.CONFIRMATION,
                 cardToAssign,
@@ -76,7 +76,7 @@ function InviteNewMemberStep({route, currentUserPersonalDetails}: InviteeNewMemb
             cardToAssign.cardName = onlyCard?.cardName;
             cardToAssign.encryptedCardNumber = onlyCard?.cardID;
             cardToAssign.startDate = assignCard?.cardToAssign?.startDate ?? new Date().toISOString().split('T').at(0);
-            cardToAssign.dateOption = assignCard?.cardToAssign?.dateOption ?? CONST.COMPANY_CARD.TRANSACTION_START_DATE_OPTIONS.CUSTOM;
+            cardToAssign.dateOption = getCardAssignmentDateOption(true, assignCard?.cardToAssign?.dateOption);
             setAssignCardStepAndData({
                 currentStep: CONST.COMPANY_CARD.STEP.CONFIRMATION,
                 cardToAssign,

From f404124c7d832b47c1c5429791eec03880939070 Mon Sep 17 00:00:00 2001
From: MelvinBot <infra+melvinbot@expensify.com>
Date: Tue, 17 Feb 2026 19:19:26 +0000
Subject: [PATCH 4/5] Fix: accept string type for existingDateOption parameter
 in getCardAssignmentDateOption

The dateOption field in AssignCardData is typed as string, so the
function parameter needs to accept string instead of the narrow
ValueOf type. Use explicit equality checks to return the properly
typed result.

Co-authored-by: Carlos Miceli <carlosmiceli@users.noreply.github.com>
---
 src/libs/CardUtils.ts | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/libs/CardUtils.ts b/src/libs/CardUtils.ts
index 15fa1a7849c9..de8ed167aff3 100644
--- a/src/libs/CardUtils.ts
+++ b/src/libs/CardUtils.ts
@@ -850,11 +850,14 @@ function getDefaultCardName(cardholder?: string) {
  * @param existingDateOption - The existing date option from previous assignment
  * @returns Date option constant
  */
-function getCardAssignmentDateOption(
-    isEditing: boolean | undefined,
-    existingDateOption?: ValueOf<typeof CONST.COMPANY_CARD.TRANSACTION_START_DATE_OPTIONS>,
-): ValueOf<typeof CONST.COMPANY_CARD.TRANSACTION_START_DATE_OPTIONS> {
-    return isEditing ? (existingDateOption ?? CONST.COMPANY_CARD.TRANSACTION_START_DATE_OPTIONS.CUSTOM) : CONST.COMPANY_CARD.TRANSACTION_START_DATE_OPTIONS.CUSTOM;
+function getCardAssignmentDateOption(isEditing: boolean | undefined, existingDateOption?: string): ValueOf<typeof CONST.COMPANY_CARD.TRANSACTION_START_DATE_OPTIONS> {
+    if (!isEditing) {
+        return CONST.COMPANY_CARD.TRANSACTION_START_DATE_OPTIONS.CUSTOM;
+    }
+    if (existingDateOption === CONST.COMPANY_CARD.TRANSACTION_START_DATE_OPTIONS.FROM_BEGINNING) {
+        return CONST.COMPANY_CARD.TRANSACTION_START_DATE_OPTIONS.FROM_BEGINNING;
+    }
+    return CONST.COMPANY_CARD.TRANSACTION_START_DATE_OPTIONS.CUSTOM;
 }
 
 function checkIfNewFeedConnected(prevFeedsData: CompanyFeeds, currentFeedsData: CompanyFeeds, plaidBank?: string) {

From 7cb081e424ef6d1e2de1d25940320eddd8078c18 Mon Sep 17 00:00:00 2001
From: MelvinBot <infra+melvinbot@expensify.com>
Date: Tue, 17 Feb 2026 22:42:39 +0000
Subject: [PATCH 5/5] Extract getCardAssignmentStartDate util and trim JSDoc

- Add getCardAssignmentStartDate to eliminate duplicated startDate
  ternary in AssigneeStep.tsx
- Trim verbose JSDoc on getCardAssignmentDateOption to a single
  summary line
- Remove unused date-fns format import from AssigneeStep.tsx

Co-authored-by: Carlos Miceli <carlosmiceli@users.noreply.github.com>
---
 src/libs/CardUtils.ts                         | 21 ++++++++++---------
 .../companyCards/assignCard/AssigneeStep.tsx  | 11 +++-------
 2 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/src/libs/CardUtils.ts b/src/libs/CardUtils.ts
index de8ed167aff3..9fa012767be0 100644
--- a/src/libs/CardUtils.ts
+++ b/src/libs/CardUtils.ts
@@ -1,5 +1,5 @@
 import type {FeedKeysWithAssignedCards} from '@selectors/Card';
-import {fromUnixTime, isBefore} from 'date-fns';
+import {format, fromUnixTime, isBefore} from 'date-fns';
 import groupBy from 'lodash/groupBy';
 import type {OnyxCollection, OnyxEntry} from 'react-native-onyx';
 import type {TupleToUnion, ValueOf} from 'type-fest';
@@ -841,15 +841,7 @@ function getDefaultCardName(cardholder?: string) {
     return `${cardholder}'s card`;
 }
 
-/**
- * Gets the date option for a card assignment.
- * When not editing, always returns CUSTOM option.
- * When editing, returns the existing date option or CUSTOM as fallback.
- *
- * @param isEditing - Whether the card assignment is being edited
- * @param existingDateOption - The existing date option from previous assignment
- * @returns Date option constant
- */
+/** Returns the date option for a card assignment — CUSTOM when not editing, or the existing option when editing. */
 function getCardAssignmentDateOption(isEditing: boolean | undefined, existingDateOption?: string): ValueOf<typeof CONST.COMPANY_CARD.TRANSACTION_START_DATE_OPTIONS> {
     if (!isEditing) {
         return CONST.COMPANY_CARD.TRANSACTION_START_DATE_OPTIONS.CUSTOM;
@@ -860,6 +852,14 @@ function getCardAssignmentDateOption(isEditing: boolean | undefined, existingDat
     return CONST.COMPANY_CARD.TRANSACTION_START_DATE_OPTIONS.CUSTOM;
 }
 
+/** Returns the start date for a card assignment — today when not editing, or the existing date when editing. */
+function getCardAssignmentStartDate(isEditing: boolean | undefined, existingStartDate?: string): string {
+    if (isEditing && existingStartDate) {
+        return existingStartDate;
+    }
+    return format(new Date(), CONST.DATE.FNS_FORMAT_STRING);
+}
+
 function checkIfNewFeedConnected(prevFeedsData: CompanyFeeds, currentFeedsData: CompanyFeeds, plaidBank?: string) {
     const prevFeeds = Object.keys(prevFeedsData);
     const currentFeeds = Object.keys(currentFeedsData);
@@ -1221,6 +1221,7 @@ export {
     checkIfNewFeedConnected,
     getDefaultCardName,
     getCardAssignmentDateOption,
+    getCardAssignmentStartDate,
     getDomainOrWorkspaceAccountID,
     mergeCardListWithWorkspaceFeeds,
     isCard,
diff --git a/src/pages/workspace/companyCards/assignCard/AssigneeStep.tsx b/src/pages/workspace/companyCards/assignCard/AssigneeStep.tsx
index ba13fb6038c5..e9c1fdc6fcae 100644
--- a/src/pages/workspace/companyCards/assignCard/AssigneeStep.tsx
+++ b/src/pages/workspace/companyCards/assignCard/AssigneeStep.tsx
@@ -1,4 +1,3 @@
-import {format} from 'date-fns';
 import {Str} from 'expensify-common';
 import React, {useEffect, useMemo, useState} from 'react';
 import {Keyboard} from 'react-native';
@@ -16,7 +15,7 @@ import useSearchSelector from '@hooks/useSearchSelector';
 import useThemeStyles from '@hooks/useThemeStyles';
 import {setDraftInviteAccountID} from '@libs/actions/Card';
 import {searchInServer} from '@libs/actions/Report';
-import {getCardAssignmentDateOption, getDefaultCardName} from '@libs/CardUtils';
+import {getCardAssignmentDateOption, getCardAssignmentStartDate, getDefaultCardName} from '@libs/CardUtils';
 import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
 import type {SettingsNavigatorParamList} from '@libs/Navigation/types';
 import {getHeaderMessage, getSearchValueForPhoneOrEmail, sortAlphabetically} from '@libs/OptionsListUtils';
@@ -92,9 +91,7 @@ function AssigneeStep({route}: AssigneeStepProps) {
                 cardToAssign.encryptedCardNumber = assignCard.cardToAssign.encryptedCardNumber;
                 cardToAssign.cardName = assignCard.cardToAssign.cardName;
                 cardToAssign.customCardName = assignCard.cardToAssign.customCardName ?? defaultCardName;
-                cardToAssign.startDate = !isEditing
-                    ? format(new Date(), CONST.DATE.FNS_FORMAT_STRING)
-                    : (assignCard?.cardToAssign?.startDate ?? format(new Date(), CONST.DATE.FNS_FORMAT_STRING));
+                cardToAssign.startDate = getCardAssignmentStartDate(isEditing, assignCard?.cardToAssign?.startDate);
                 cardToAssign.dateOption = getCardAssignmentDateOption(isEditing, assignCard?.cardToAssign?.dateOption);
                 setAssignCardStepAndData({
                     cardToAssign,
@@ -127,9 +124,7 @@ function AssigneeStep({route}: AssigneeStepProps) {
             cardToAssign.encryptedCardNumber = assignCard.cardToAssign.encryptedCardNumber;
             cardToAssign.cardName = assignCard.cardToAssign.cardName;
             cardToAssign.customCardName = assignCard.cardToAssign.customCardName ?? defaultCardName;
-            cardToAssign.startDate = !isEditing
-                ? format(new Date(), CONST.DATE.FNS_FORMAT_STRING)
-                : (assignCard?.cardToAssign?.startDate ?? format(new Date(), CONST.DATE.FNS_FORMAT_STRING));
+            cardToAssign.startDate = getCardAssignmentStartDate(isEditing, assignCard?.cardToAssign?.startDate);
             cardToAssign.dateOption = getCardAssignmentDateOption(isEditing, assignCard?.cardToAssign?.dateOption);
             setAssignCardStepAndData({
                 cardToAssign,
