Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert using timestamps for created when submitting money requests #43319

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions src/libs/DateUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -835,7 +826,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 @@ -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,
Expand All @@ -2307,7 +2306,7 @@ function createDistanceRequest(
comment,
amount,
currency,
currentCreated,
created,
merchant,
optimisticReceipt,
undefined,
Expand Down Expand Up @@ -2335,7 +2334,7 @@ function createDistanceRequest(
createdIOUReportActionID,
reportPreviewReportActionID: reportPreviewAction.reportActionID,
waypoints: JSON.stringify(validWaypoints),
created: currentCreated,
created,
category,
tag,
taxCode,
Expand Down Expand Up @@ -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 {
Expand All @@ -3412,7 +3410,7 @@ function requestMoney(
comment,
amount,
currency,
currentCreated,
created,
merchant,
receipt,
isMovingTransactionFromTrackExpense ? (linkedTrackedExpenseReportAction?.originalMessage as IOUMessage)?.IOUTransactionID : undefined,
Expand Down Expand Up @@ -3456,7 +3454,7 @@ function requestMoney(
currency,
comment,
merchant,
currentCreated,
created,
receipt,
);
break;
Expand All @@ -3468,7 +3466,7 @@ function requestMoney(
amount,
currency,
comment,
created: currentCreated,
created,
merchant,
iouReportID: iouReport.reportID,
chatReportID: chatReport.reportID,
Expand Down Expand Up @@ -3571,7 +3569,6 @@ function trackExpense(
const moneyRequestReportID = isMoneyRequestReport ? report.reportID : '';
const isMovingTransactionFromTrackExpense = IOUUtils.isMovingTransactionFromTrackExpense(action);

const currentCreated = DateUtils.enrichMoneyRequestTimestamp(created);
const {
createdWorkspaceParams,
iouReport,
Expand All @@ -3591,7 +3588,7 @@ function trackExpense(
comment,
amount,
currency,
currentCreated,
created,
merchant,
receipt,
category,
Expand Down Expand Up @@ -3631,7 +3628,7 @@ function trackExpense(
currency,
comment,
merchant,
currentCreated,
created,
category,
tag,
taxCode,
Expand Down Expand Up @@ -3662,7 +3659,7 @@ function trackExpense(
currency,
comment,
merchant,
currentCreated,
created,
category,
tag,
taxCode,
Expand All @@ -3678,7 +3675,7 @@ function trackExpense(
amount,
currency,
comment,
created: currentCreated,
created,
merchant,
iouReportID: iouReport?.reportID,
chatReportID: chatReport.reportID,
Expand Down Expand Up @@ -4217,7 +4214,6 @@ function splitBill({
taxCode = '',
taxAmount = 0,
}: SplitBillActionsParams) {
const currentCreated = DateUtils.enrichMoneyRequestTimestamp(created);
const {splitData, splits, onyxData} = createSplitsAndOnyxData(
participants,
currentUserLogin,
Expand All @@ -4226,7 +4222,7 @@ function splitBill({
comment,
currency,
merchant,
currentCreated,
created,
category,
tag,
splitShares,
Expand All @@ -4245,7 +4241,7 @@ function splitBill({
comment,
category,
merchant,
created: currentCreated,
created,
tag,
billable,
transactionID: splitData.transactionID,
Expand Down Expand Up @@ -4285,7 +4281,6 @@ function splitBillAndOpenReport({
taxCode = '',
taxAmount = 0,
}: SplitBillActionsParams) {
const currentCreated = DateUtils.enrichMoneyRequestTimestamp(created);
const {splitData, splits, onyxData} = createSplitsAndOnyxData(
participants,
currentUserLogin,
Expand All @@ -4294,7 +4289,7 @@ function splitBillAndOpenReport({
comment,
currency,
merchant,
currentCreated,
created,
category,
tag,
splitShares,
Expand All @@ -4311,7 +4306,7 @@ function splitBillAndOpenReport({
splits: JSON.stringify(splits),
currency,
merchant,
created: currentCreated,
created,
comment,
category,
tag,
Expand Down
Loading