Fix hydration issues with date string
This commit is contained in:
parent
1e3f649a09
commit
9799442cb9
@ -10,6 +10,7 @@ import {
|
|||||||
StackDivider,
|
StackDivider,
|
||||||
Text,
|
Text,
|
||||||
} from "@chakra-ui/react";
|
} from "@chakra-ui/react";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
export default function (props: {
|
export default function (props: {
|
||||||
ban_reason: string;
|
ban_reason: string;
|
||||||
@ -20,6 +21,14 @@ export default function (props: {
|
|||||||
reason_for_unban: string;
|
reason_for_unban: string;
|
||||||
username: string;
|
username: string;
|
||||||
}) {
|
}) {
|
||||||
|
const [dateString, setDateString] = useState(
|
||||||
|
new Date(props.createdAt).toUTCString()
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setDateString(new Date(props.createdAt).toLocaleString());
|
||||||
|
}, [props.createdAt]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Card>
|
<Card>
|
||||||
@ -46,13 +55,15 @@ export default function (props: {
|
|||||||
</Box>
|
</Box>
|
||||||
<Box>
|
<Box>
|
||||||
<Button colorScheme="red">Deny</Button>
|
<Button colorScheme="red">Deny</Button>
|
||||||
<Button colorScheme="blue" ml="8px">Accept</Button>
|
<Button colorScheme="blue" ml="8px">
|
||||||
|
Accept
|
||||||
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
</Stack>
|
</Stack>
|
||||||
</CardBody>
|
</CardBody>
|
||||||
<CardFooter>
|
<CardFooter>
|
||||||
<Text fontSize="xs">
|
<Text fontSize="xs">
|
||||||
Submitted at: {new Date(props.createdAt).toLocaleString()}
|
Submitted at: {dateString}
|
||||||
<br />
|
<br />
|
||||||
ID: {props.id}
|
ID: {props.id}
|
||||||
</Text>
|
</Text>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user