Skip to content

Commit

Permalink
Merge pull request #43319 from Expensify/rocio-RequestTime
Browse files Browse the repository at this point in the history
Revert using timestamps for created when submitting money requests
  • Loading branch information
bondydaa authored Jun 12, 2024
2 parents 79e619a + 2af7d53 commit c82dafd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 28 deletions.
10 changes: 0 additions & 10 deletions src/libs/DateUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -836,7 +827,6 @@ const DateUtils = {
getWeekEndsOn,
isTimeAtLeastOneMinuteInFuture,
formatToSupportedTimezone,
enrichMoneyRequestTimestamp,
getLastBusinessDayOfMonth,
getFormattedDateRange,
getFormattedReservationRangeDate,
Expand Down
31 changes: 13 additions & 18 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -2333,7 +2332,7 @@ function createDistanceRequest(
comment,
amount,
currency,
currentCreated,
created,
merchant,
optimisticReceipt,
undefined,
Expand Down Expand Up @@ -2361,7 +2360,7 @@ function createDistanceRequest(
createdIOUReportActionID,
reportPreviewReportActionID: reportPreviewAction.reportActionID,
waypoints: JSON.stringify(validWaypoints),
created: currentCreated,
created,
category,
tag,
taxCode,
Expand Down Expand Up @@ -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 {
Expand All @@ -3439,7 +3437,7 @@ function requestMoney(
comment,
amount,
currency,
currentCreated,
created,
merchant,
receipt,
isMovingTransactionFromTrackExpense ? (linkedTrackedExpenseReportAction?.originalMessage as IOUMessage)?.IOUTransactionID : undefined,
Expand Down Expand Up @@ -3483,7 +3481,7 @@ function requestMoney(
currency,
comment,
merchant,
currentCreated,
created,
receipt,
);
break;
Expand All @@ -3495,7 +3493,7 @@ function requestMoney(
amount,
currency,
comment,
created: currentCreated,
created,
merchant,
iouReportID: iouReport.reportID,
chatReportID: chatReport.reportID,
Expand Down Expand Up @@ -3598,7 +3596,6 @@ function trackExpense(
const moneyRequestReportID = isMoneyRequestReport ? report.reportID : '';
const isMovingTransactionFromTrackExpense = IOUUtils.isMovingTransactionFromTrackExpense(action);

const currentCreated = DateUtils.enrichMoneyRequestTimestamp(created);
const {
createdWorkspaceParams,
iouReport,
Expand All @@ -3618,7 +3615,7 @@ function trackExpense(
comment,
amount,
currency,
currentCreated,
created,
merchant,
receipt,
category,
Expand Down Expand Up @@ -3658,7 +3655,7 @@ function trackExpense(
currency,
comment,
merchant,
currentCreated,
created,
category,
tag,
taxCode,
Expand Down Expand Up @@ -3689,7 +3686,7 @@ function trackExpense(
currency,
comment,
merchant,
currentCreated,
created,
category,
tag,
taxCode,
Expand All @@ -3705,7 +3702,7 @@ function trackExpense(
amount,
currency,
comment,
created: currentCreated,
created,
merchant,
iouReportID: iouReport?.reportID,
chatReportID: chatReport.reportID,
Expand Down Expand Up @@ -4245,7 +4242,6 @@ function splitBill({
taxCode = '',
taxAmount = 0,
}: SplitBillActionsParams) {
const currentCreated = DateUtils.enrichMoneyRequestTimestamp(created);
const {splitData, splits, onyxData} = createSplitsAndOnyxData(
participants,
currentUserLogin,
Expand All @@ -4254,7 +4250,7 @@ function splitBill({
comment,
currency,
merchant,
currentCreated,
created,
category,
tag,
splitShares,
Expand All @@ -4273,7 +4269,7 @@ function splitBill({
comment,
category,
merchant,
created: currentCreated,
created,
tag,
billable,
transactionID: splitData.transactionID,
Expand Down Expand Up @@ -4313,7 +4309,6 @@ function splitBillAndOpenReport({
taxCode = '',
taxAmount = 0,
}: SplitBillActionsParams) {
const currentCreated = DateUtils.enrichMoneyRequestTimestamp(created);
const {splitData, splits, onyxData} = createSplitsAndOnyxData(
participants,
currentUserLogin,
Expand All @@ -4322,7 +4317,7 @@ function splitBillAndOpenReport({
comment,
currency,
merchant,
currentCreated,
created,
category,
tag,
splitShares,
Expand All @@ -4339,7 +4334,7 @@ function splitBillAndOpenReport({
splits: JSON.stringify(splits),
currency,
merchant,
created: currentCreated,
created,
comment,
category,
tag,
Expand Down

0 comments on commit c82dafd

Please sign in to comment.