diff --git a/src/pages/system/adminlog/index.tsx b/src/pages/system/adminlog/index.tsx index 05cbb5a..754d2d1 100644 --- a/src/pages/system/adminlog/index.tsx +++ b/src/pages/system/adminlog/index.tsx @@ -3,7 +3,7 @@ import { Table, Typography, Input, Button, DatePicker } from "antd"; import { adminLog } from "../../../api"; // import styles from "./index.module.less"; import type { ColumnsType } from "antd/es/table"; -import { dateWholeFormat } from "../../../utils/index"; +import { dateWholeFormat, transUtcTime } from "../../../utils/index"; import { AdminLogDetailDialog } from "./compenents/detail-dialog"; const { RangePicker } = DatePicker; import moment from "moment"; @@ -176,8 +176,10 @@ const SystemLogPage = () => { value={createdAts} style={{ marginLeft: 10 }} onChange={(date, dateString) => { - dateString[0] += "T00:00:00.000+00:00"; - dateString[1] += "T23:59:59.000+00:00"; + let date1 = dateString[0] + " 00:00:00"; + let date2 = dateString[1] + " 23:59:59"; + dateString[0] = transUtcTime(date1); + dateString[1] = transUtcTime(date2); setCreatedAt(dateString); setCreatedAts(date); }} diff --git a/src/utils/index.ts b/src/utils/index.ts index 9bc1079..b37888b 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -140,3 +140,13 @@ export function dateWholeFormat(dateStr: string) { } return moment(dateStr).format("YYYY-MM-DD HH:mm:ss"); } + +export function transUtcTime(value: string) { + const specifiedTime = value; + // 创建一个新的Date对象,传入指定时间 + const specifiedDate = new Date(specifiedTime); + //将指定时间转换为UTC+0时间 + const utcTime = specifiedDate.toISOString(); + + return utcTime; +}