Client: Date time zones now handled correctly

This commit is contained in:
Donkie
2023-05-18 13:38:38 +02:00
parent 60ea450ce2
commit 646ade1721
7 changed files with 70 additions and 10 deletions

View File

@@ -9,6 +9,10 @@ import {
} from "@refinedev/antd";
import { Table, Space } from "antd";
import { NumberFieldUnit } from "../../components/numberField";
import dayjs from "dayjs";
import utc from "dayjs/plugin/utc";
dayjs.extend(utc);
export const FilamentList: React.FC<IResourceComponentsProps> = () => {
const { tableProps } = useTable({
@@ -90,7 +94,11 @@ export const FilamentList: React.FC<IResourceComponentsProps> = () => {
dataIndex={["registered"]}
title="Registered"
render={(value) => (
<DateField value={value} format="YYYY-MM-DD HH:mm:ss" />
<DateField
value={dayjs.utc(value).local()}
title={dayjs.utc(value).local().format()}
format="YYYY-MM-DD HH:mm:ss"
/>
)}
/>
<Table.Column dataIndex={["comment"]} title="Comment" />

View File

@@ -3,6 +3,10 @@ import { IResourceComponentsProps, useShow } from "@refinedev/core";
import { Show, NumberField, DateField, TextField } from "@refinedev/antd";
import { Typography } from "antd";
import { NumberFieldUnit } from "../../components/numberField";
import dayjs from "dayjs";
import utc from "dayjs/plugin/utc";
dayjs.extend(utc);
const { Title } = Typography;
@@ -17,7 +21,11 @@ export const FilamentShow: React.FC<IResourceComponentsProps> = () => {
<Title level={5}>Id</Title>
<NumberField value={record?.id ?? ""} />
<Title level={5}>Registered</Title>
<DateField value={record?.registered} format="YYYY-MM-DD HH:mm:ss" />
<DateField
value={dayjs.utc(record?.registered).local()}
title={dayjs.utc(record?.registered).local().format()}
format="YYYY-MM-DD HH:mm:ss"
/>
<Title level={5}>Name</Title>
<TextField value={record?.name} />
<Title level={5}>Vendor</Title>