Use GMT+8
This commit is contained in:
parent
5ee6535985
commit
eacd7fe5c5
@ -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 <span>{record['Created Date'].toString().split('T')[0]}</span>;
|
||||
return <span>{datetimeStrToDate(record['Created Date'], 'Asia/Singapore')}</span>;
|
||||
},
|
||||
width: 110,
|
||||
},
|
||||
@ -54,7 +55,7 @@ const ReportTable: React.FC = () => {
|
||||
dataIndex: 'Start Date',
|
||||
key: 'Start Date',
|
||||
render: (_, record) => {
|
||||
return <span>{record['Start Date'].toString().split('T')[0]}</span>;
|
||||
return <span>{datetimeStrToDate(record['Start Date'], 'Asia/Singapore')}</span>;
|
||||
},
|
||||
width: 110,
|
||||
},
|
||||
@ -63,7 +64,7 @@ const ReportTable: React.FC = () => {
|
||||
dataIndex: 'End Date',
|
||||
key: 'End Date',
|
||||
render: (_, record) => {
|
||||
return <span>{record['End Date'].toString().split('T')[0]}</span>;
|
||||
return <span>{datetimeStrToDate(record['End Date'], 'Asia/Singapore')}</span>;
|
||||
},
|
||||
width: 110,
|
||||
},
|
||||
|
6
cope2n-fe/src/utils/time.ts
Normal file
6
cope2n-fe/src/utils/time.ts
Normal file
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user