From 92989f1e21a26be66e470468a0d16ac7c891cade Mon Sep 17 00:00:00 2001 From: VickyStash Date: Tue, 5 Nov 2024 09:03:13 +0100 Subject: [PATCH 1/2] Fix transaction date display --- .../workspace/companyCards/assignCard/ConfirmationStep.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/companyCards/assignCard/ConfirmationStep.tsx b/src/pages/workspace/companyCards/assignCard/ConfirmationStep.tsx index 2d0fab26b070..01933f827362 100644 --- a/src/pages/workspace/companyCards/assignCard/ConfirmationStep.tsx +++ b/src/pages/workspace/companyCards/assignCard/ConfirmationStep.tsx @@ -81,7 +81,7 @@ function ConfirmationStep({policyID, backTo}: ConfirmationStepProps) { /> editStep(CONST.COMPANY_CARD.STEP.TRANSACTION_START_DATE)} /> From 2cf0cff17e2e5531813688df95b7897e578d6691 Mon Sep 17 00:00:00 2001 From: VickyStash Date: Tue, 5 Nov 2024 09:21:25 +0100 Subject: [PATCH 2/2] Update start date for From the beginning option --- .../companyCards/assignCard/TransactionStartDateStep.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/workspace/companyCards/assignCard/TransactionStartDateStep.tsx b/src/pages/workspace/companyCards/assignCard/TransactionStartDateStep.tsx index d3598ec7ffcc..576a27af18c8 100644 --- a/src/pages/workspace/companyCards/assignCard/TransactionStartDateStep.tsx +++ b/src/pages/workspace/companyCards/assignCard/TransactionStartDateStep.tsx @@ -1,3 +1,4 @@ +import {subDays} from 'date-fns'; import React, {useMemo, useState} from 'react'; import {View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; @@ -55,11 +56,13 @@ function TransactionStartDateStep() { }; const submit = () => { + const date90DaysBack = DateUtils.extractDate(subDays(new Date(), 90).toString()); + CompanyCards.setAssignCardStepAndData({ currentStep: CONST.COMPANY_CARD.STEP.CONFIRMATION, data: { dateOption: dateOptionSelected, - startDate, + startDate: dateOptionSelected === CONST.COMPANY_CARD.TRANSACTION_START_DATE_OPTIONS.FROM_BEGINNING ? date90DaysBack : startDate, }, isEditing: false, });