diff --git a/src/libs/DateUtils.ts b/src/libs/DateUtils.ts index 50cb9a20dff6..d7a40746584b 100644 --- a/src/libs/DateUtils.ts +++ b/src/libs/DateUtils.ts @@ -702,15 +702,6 @@ function formatToSupportedTimezone(timezoneInput: Timezone): Timezone { }; } -/** - * Return the date with full format if the created date is the current date. - * Otherwise return the created date. - */ -function enrichMoneyRequestTimestamp(created: string): string { - const now = new Date(); - const createdDate = parse(created, CONST.DATE.FNS_FORMAT_STRING, now); - return isSameDay(createdDate, now) ? getDBTimeFromDate(now) : created; -} /** * Returns the last business day of given date month * @@ -835,7 +826,6 @@ const DateUtils = { getWeekEndsOn, isTimeAtLeastOneMinuteInFuture, formatToSupportedTimezone, - enrichMoneyRequestTimestamp, getLastBusinessDayOfMonth, getFormattedDateRange, getFormattedReservationRangeDate, diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 1bd4de43acfb..a682ef74b5c3 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -2283,7 +2283,6 @@ function createDistanceRequest( const isMoneyRequestReport = ReportUtils.isMoneyRequestReport(report); const currentChatReport = isMoneyRequestReport ? ReportUtils.getReport(report?.chatReportID) : report; const moneyRequestReportID = isMoneyRequestReport ? report?.reportID : ''; - const currentCreated = DateUtils.enrichMoneyRequestTimestamp(created); const optimisticReceipt: Receipt = { source: ReceiptGeneric as ReceiptSource, @@ -2307,7 +2306,7 @@ function createDistanceRequest( comment, amount, currency, - currentCreated, + created, merchant, optimisticReceipt, undefined, @@ -2335,7 +2334,7 @@ function createDistanceRequest( createdIOUReportActionID, reportPreviewReportActionID: reportPreviewAction.reportActionID, waypoints: JSON.stringify(validWaypoints), - created: currentCreated, + created, category, tag, taxCode, @@ -3390,7 +3389,6 @@ function requestMoney( const isMoneyRequestReport = ReportUtils.isMoneyRequestReport(report); const currentChatReport = isMoneyRequestReport ? ReportUtils.getReport(report?.chatReportID) : report; const moneyRequestReportID = isMoneyRequestReport ? report?.reportID : ''; - const currentCreated = DateUtils.enrichMoneyRequestTimestamp(created); const isMovingTransactionFromTrackExpense = IOUUtils.isMovingTransactionFromTrackExpense(action); const { @@ -3412,7 +3410,7 @@ function requestMoney( comment, amount, currency, - currentCreated, + created, merchant, receipt, isMovingTransactionFromTrackExpense ? (linkedTrackedExpenseReportAction?.originalMessage as IOUMessage)?.IOUTransactionID : undefined, @@ -3456,7 +3454,7 @@ function requestMoney( currency, comment, merchant, - currentCreated, + created, receipt, ); break; @@ -3468,7 +3466,7 @@ function requestMoney( amount, currency, comment, - created: currentCreated, + created, merchant, iouReportID: iouReport.reportID, chatReportID: chatReport.reportID, @@ -3571,7 +3569,6 @@ function trackExpense( const moneyRequestReportID = isMoneyRequestReport ? report.reportID : ''; const isMovingTransactionFromTrackExpense = IOUUtils.isMovingTransactionFromTrackExpense(action); - const currentCreated = DateUtils.enrichMoneyRequestTimestamp(created); const { createdWorkspaceParams, iouReport, @@ -3591,7 +3588,7 @@ function trackExpense( comment, amount, currency, - currentCreated, + created, merchant, receipt, category, @@ -3631,7 +3628,7 @@ function trackExpense( currency, comment, merchant, - currentCreated, + created, category, tag, taxCode, @@ -3662,7 +3659,7 @@ function trackExpense( currency, comment, merchant, - currentCreated, + created, category, tag, taxCode, @@ -3678,7 +3675,7 @@ function trackExpense( amount, currency, comment, - created: currentCreated, + created, merchant, iouReportID: iouReport?.reportID, chatReportID: chatReport.reportID, @@ -4217,7 +4214,6 @@ function splitBill({ taxCode = '', taxAmount = 0, }: SplitBillActionsParams) { - const currentCreated = DateUtils.enrichMoneyRequestTimestamp(created); const {splitData, splits, onyxData} = createSplitsAndOnyxData( participants, currentUserLogin, @@ -4226,7 +4222,7 @@ function splitBill({ comment, currency, merchant, - currentCreated, + created, category, tag, splitShares, @@ -4245,7 +4241,7 @@ function splitBill({ comment, category, merchant, - created: currentCreated, + created, tag, billable, transactionID: splitData.transactionID, @@ -4285,7 +4281,6 @@ function splitBillAndOpenReport({ taxCode = '', taxAmount = 0, }: SplitBillActionsParams) { - const currentCreated = DateUtils.enrichMoneyRequestTimestamp(created); const {splitData, splits, onyxData} = createSplitsAndOnyxData( participants, currentUserLogin, @@ -4294,7 +4289,7 @@ function splitBillAndOpenReport({ comment, currency, merchant, - currentCreated, + created, category, tag, splitShares, @@ -4311,7 +4306,7 @@ function splitBillAndOpenReport({ splits: JSON.stringify(splits), currency, merchant, - created: currentCreated, + created, comment, category, tag,