refactor formating to utils file

This commit is contained in:
Alex Holliday committed 2024-09-12 12:17:31 +08:00
1 parent e8bb31b007
commit 2bdf01abd6
6 files changed
+95 -64

No files matched your search

@@ -21,13 +21,9 @@ import { networkService } from "../../../main";
import { StatusLabel } from "../../../Components/Label";
import { logger } from "../../../Utils/Logger";
import { useTheme } from "@emotion/react";
import dayjs from "dayjs";
import utc from "dayjs/plugin/utc";
import timezone from "dayjs/plugin/timezone";
import { formatDateWithTz } from "../../../Utils/timeUtils";
const IncidentTable = ({ monitors, selectedMonitor, filter }) => {
dayjs.extend(utc);
dayjs.extend(timezone);
const uiTimezone = useSelector((state) => state.ui.timezone);
const theme = useTheme();
@@ -159,9 +155,11 @@ const IncidentTable = ({ monitors, selectedMonitor, filter }) => {
<TableBody>
{checks.map((check) => {
const status = check.status === true ? "up" : "down";
const formattedDate = dayjs(check.createdAt)
.tz(uiTimezone)
.format("YYYY-MM-DD HH:mm:ss");
const formattedDate = formatDateWithTz(
check.createdAt,
"YYYY-MM-DD HH:mm:ss A",
uiTimezone
);
return (
<TableRow key={check._id}>