mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-18 08:02:03 +03:00
a5c71be731
* ✨ 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
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>
|
|
</>
|
|
);
|
|
};
|