diff --git a/src/libs/DateUtils.ts b/src/libs/DateUtils.ts index 8e462e109bf9..7880e36a52e2 100644 --- a/src/libs/DateUtils.ts +++ b/src/libs/DateUtils.ts @@ -703,15 +703,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 * @@ -836,7 +827,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 c4484ca04b0c..56aac2a009d8 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -2309,7 +2309,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, @@ -2333,7 +2332,7 @@ function createDistanceRequest( comment, amount, currency, - currentCreated, + created, merchant, optimisticReceipt, undefined, @@ -2361,7 +2360,7 @@ function createDistanceRequest( createdIOUReportActionID, reportPreviewReportActionID: reportPreviewAction.reportActionID, waypoints: JSON.stringify(validWaypoints), - created: currentCreated, + created, category, tag, taxCode, @@ -3417,7 +3416,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 { @@ -3439,7 +3437,7 @@ function requestMoney( comment, amount, currency, - currentCreated, + created, merchant, receipt, isMovingTransactionFromTrackExpense ? (linkedTrackedExpenseReportAction?.originalMessage as IOUMessage)?.IOUTransactionID : undefined, @@ -3483,7 +3481,7 @@ function requestMoney( currency, comment, merchant, - currentCreated, + created, receipt, ); break; @@ -3495,7 +3493,7 @@ function requestMoney( amount, currency, comment, - created: currentCreated, + created, merchant, iouReportID: iouReport.reportID, chatReportID: chatReport.reportID, @@ -3598,7 +3596,6 @@ function trackExpense( const moneyRequestReportID = isMoneyRequestReport ? report.reportID : ''; const isMovingTransactionFromTrackExpense = IOUUtils.isMovingTransactionFromTrackExpense(action); - const currentCreated = DateUtils.enrichMoneyRequestTimestamp(created); const { createdWorkspaceParams, iouReport, @@ -3618,7 +3615,7 @@ function trackExpense( comment, amount, currency, - currentCreated, + created, merchant, receipt, category, @@ -3658,7 +3655,7 @@ function trackExpense( currency, comment, merchant, - currentCreated, + created, category, tag, taxCode, @@ -3689,7 +3686,7 @@ function trackExpense( currency, comment, merchant, - currentCreated, + created, category, tag, taxCode, @@ -3705,7 +3702,7 @@ function trackExpense( amount, currency, comment, - created: currentCreated, + created, merchant, iouReportID: iouReport?.reportID, chatReportID: chatReport.reportID, @@ -4245,7 +4242,6 @@ function splitBill({ taxCode = '', taxAmount = 0, }: SplitBillActionsParams) { - const currentCreated = DateUtils.enrichMoneyRequestTimestamp(created); const {splitData, splits, onyxData} = createSplitsAndOnyxData( participants, currentUserLogin, @@ -4254,7 +4250,7 @@ function splitBill({ comment, currency, merchant, - currentCreated, + created, category, tag, splitShares, @@ -4273,7 +4269,7 @@ function splitBill({ comment, category, merchant, - created: currentCreated, + created, tag, billable, transactionID: splitData.transactionID, @@ -4313,7 +4309,6 @@ function splitBillAndOpenReport({ taxCode = '', taxAmount = 0, }: SplitBillActionsParams) { - const currentCreated = DateUtils.enrichMoneyRequestTimestamp(created); const {splitData, splits, onyxData} = createSplitsAndOnyxData( participants, currentUserLogin, @@ -4322,7 +4317,7 @@ function splitBillAndOpenReport({ comment, currency, merchant, - currentCreated, + created, category, tag, splitShares, @@ -4339,7 +4334,7 @@ function splitBillAndOpenReport({ splits: JSON.stringify(splits), currency, merchant, - created: currentCreated, + created, comment, category, tag,