quivr/frontend/app/user/components/Date.tsx
Zineb El Bachiri a5c71be731
Feat/user page (#255)
*  new backend get /user endpoint

*  new user page for statistics

* 📦 add @mui/material & its dependencies
📦 add prettyBytes package

* 🌱 new UserStatistics component for user page

* 🏷️ use RequestStat type for requests_stats

*  new brainConsumption component

*  new Date component

* 📦 add  date-fns, victory

*  requests per day chart

*  full UserStatistics component

*  put UserStatistics in Card in user's page
2023-06-05 17:58:59 +02:00

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>
</>
);
};