From 8e5c07263472dc61083570c647fb17087ac9d254 Mon Sep 17 00:00:00 2001 From: unknown <18119604035@163.com> Date: Sun, 30 Jul 2023 16:58:44 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=97=A5=E5=BF=97=E6=97=B6?= =?UTF-8?q?=E5=8C=BA=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/system/adminlog/index.tsx | 8 +++++--- src/utils/index.ts | 10 ++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) 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; +}