|
1 |
| -import {format} from 'date-fns'; |
2 | 1 | import Onyx from 'react-native-onyx';
|
3 | 2 | import CONST from '@src/CONST';
|
4 | 3 | import ONYXKEYS from '@src/ONYXKEYS';
|
5 | 4 | import type {PolicyTags, ReportAction} from '@src/types/onyx';
|
6 | 5 | import * as CurrencyUtils from './CurrencyUtils';
|
| 6 | +import DateUtils from './DateUtils'; |
7 | 7 | import * as Localize from './Localize';
|
8 | 8 | import * as PolicyUtils from './PolicyUtils';
|
9 | 9 | import * as ReportUtils from './ReportUtils';
|
@@ -145,13 +145,11 @@ function getForReportAction(reportAction: ReportAction): string {
|
145 | 145 | );
|
146 | 146 | }
|
147 | 147 |
|
148 |
| - const hasModifiedCreated = reportActionOriginalMessage && 'oldCreated' in reportActionOriginalMessage && 'created' in reportActionOriginalMessage; |
149 |
| - if (hasModifiedCreated) { |
150 |
| - // Take only the YYYY-MM-DD value as the original date includes timestamp |
151 |
| - let formattedOldCreated: Date | string = new Date(reportActionOriginalMessage?.oldCreated ? reportActionOriginalMessage.oldCreated : 0); |
152 |
| - formattedOldCreated = format(formattedOldCreated, CONST.DATE.FNS_FORMAT_STRING); |
| 148 | + if (reportActionOriginalMessage?.oldCreated && reportActionOriginalMessage?.created) { |
| 149 | + const formattedOldCreated = DateUtils.formatWithUTCTimeZone(reportActionOriginalMessage.oldCreated, CONST.DATE.FNS_FORMAT_STRING); |
| 150 | + |
153 | 151 | buildMessageFragmentForValue(
|
154 |
| - reportActionOriginalMessage?.created ?? '', |
| 152 | + reportActionOriginalMessage.created, |
155 | 153 | formattedOldCreated,
|
156 | 154 | Localize.translateLocal('common.date'),
|
157 | 155 | false,
|
|
0 commit comments