Skip to content

Commit 0fbf2ee

Browse files
committed
fix: use displayDate instead of createdAt
1 parent 26cffab commit 0fbf2ee

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

apps/backoffice-v2/src/domains/business-reports/fetchers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export const BusinessReportSchema = z
2323
reportType: z.enum([MERCHANT_REPORT_TYPES[0]!, ...MERCHANT_REPORT_TYPES.slice(1)]),
2424
createdAt: z.string().datetime(),
2525
updatedAt: z.string().datetime(),
26+
displayDate: z.string().datetime(),
2627
riskScore: z.number().nullable(),
2728
status: z.enum([MERCHANT_REPORT_STATUSES[0]!, ...MERCHANT_REPORT_STATUSES.slice(1)]),
2829
parentCompanyName: z.string().nullable(),

apps/backoffice-v2/src/pages/MerchantMonitoring/components/MerchantMonitoringTable/columns.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,16 +153,12 @@ export const columns = [
153153
},
154154
header: 'Alert',
155155
}),
156-
columnHelper.accessor('createdAt', {
156+
columnHelper.accessor('displayDate', {
157157
cell: info => {
158-
const createdAt = info.getValue();
159-
160-
if (!createdAt) {
161-
return <TextWithNAFallback>{createdAt}</TextWithNAFallback>;
162-
}
158+
const displayDate = info.getValue();
163159

164160
// Convert UTC time to local browser time
165-
const localDateTime = dayjs.utc(createdAt).local();
161+
const localDateTime = dayjs.utc(displayDate).local();
166162

167163
const date = localDateTime.format('MMM DD, YYYY');
168164
const time = localDateTime.format('HH:mm');

apps/backoffice-v2/src/pages/MerchantMonitoringBusinessReport/MerchantMonitoringBusinessReport.page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,8 @@ export const MerchantMonitoringBusinessReport: FunctionComponent = () => {
272272
</div>
273273
<div className={`text-sm`}>
274274
<span className={`me-2 leading-6 text-slate-400`}>Created at</span>
275-
{businessReport?.createdAt &&
276-
dayjs(new Date(businessReport?.createdAt)).format('HH:mm MMM Do, YYYY')}
275+
{businessReport?.displayDate &&
276+
dayjs(new Date(businessReport?.displayDate)).format('HH:mm MMM Do, YYYY')}
277277
</div>
278278
<div className={`flex items-center space-x-2 text-sm`}>
279279
<span className={`text-slate-400`}>Monitoring Status</span>

services/workflows-service/src/business-report/merchant-monitoring-client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ const ReportSchema = z.object({
5050
.string()
5151
.datetime()
5252
.transform(value => new Date(value)),
53+
displayDate: z
54+
.string()
55+
.datetime()
56+
.transform(value => new Date(value)),
5357
data: z.record(z.string(), z.unknown()).nullish(),
5458
});
5559

0 commit comments

Comments
 (0)