mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-18 08:02:03 +03:00
21 lines
556 B
TypeScript
21 lines
556 B
TypeScript
|
import { Typography } from "@mui/material";
|
||
|
import { UserStats } from "../types";
|
||
|
|
||
|
export const DateComponent = ({ date }: UserStats): JSX.Element => {
|
||
|
// Extract year, month, and day from the date string
|
||
|
const year = date.slice(0, 4);
|
||
|
const month = date.slice(4, 6);
|
||
|
const day = date.slice(6, 8);
|
||
|
|
||
|
const formattedDate = new Date(
|
||
|
`${year}-${month}-${day}`
|
||
|
).toLocaleDateString();
|
||
|
|
||
|
return (
|
||
|
<>
|
||
|
<Typography variant="h5">{"Today's date"}</Typography>
|
||
|
<Typography variant="body1">{formattedDate}</Typography>
|
||
|
</>
|
||
|
);
|
||
|
};
|