diff --git a/cope2n-fe/src/components/report-detail/report-table.tsx b/cope2n-fe/src/components/report-detail/report-table.tsx
index 07fd087..e0091be 100644
--- a/cope2n-fe/src/components/report-detail/report-table.tsx
+++ b/cope2n-fe/src/components/report-detail/report-table.tsx
@@ -6,6 +6,7 @@ import React, { useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { downloadReport } from 'request/report';
import { formatPercent, ensureMin, ensureMax } from 'utils/metric-format';
+import { datetimeStrToDate } from 'utils/time';
const ReportTable: React.FC = () => {
@@ -45,7 +46,7 @@ const ReportTable: React.FC = () => {
dataIndex: 'Created Date',
key: 'Created Date',
render: (_, record) => {
- return {record['Created Date'].toString().split('T')[0]};
+ return {datetimeStrToDate(record['Created Date'], 'Asia/Singapore')};
},
width: 110,
},
@@ -54,7 +55,7 @@ const ReportTable: React.FC = () => {
dataIndex: 'Start Date',
key: 'Start Date',
render: (_, record) => {
- return {record['Start Date'].toString().split('T')[0]};
+ return {datetimeStrToDate(record['Start Date'], 'Asia/Singapore')};
},
width: 110,
},
@@ -63,7 +64,7 @@ const ReportTable: React.FC = () => {
dataIndex: 'End Date',
key: 'End Date',
render: (_, record) => {
- return {record['End Date'].toString().split('T')[0]};
+ return {datetimeStrToDate(record['End Date'], 'Asia/Singapore')};
},
width: 110,
},
diff --git a/cope2n-fe/src/utils/time.ts b/cope2n-fe/src/utils/time.ts
new file mode 100644
index 0000000..e6768b3
--- /dev/null
+++ b/cope2n-fe/src/utils/time.ts
@@ -0,0 +1,6 @@
+export function datetimeStrToDate(dateTimeStr: string, targetTimeZone: string): string {
+ const options: Intl.DateTimeFormatOptions = { timeZone: targetTimeZone, year: 'numeric', month: '2-digit', day: '2-digit' };
+ const date = new Date(dateTimeStr);
+ const convertedDateTimeStr = date.toLocaleDateString('en-US', options).split('/').reverse().join('-');
+ return convertedDateTimeStr;
+}
\ No newline at end of file