mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-18 08:02:03 +03:00
98c409176d
* style(user): remove mui and complete overhaul of the layout * docs(user): add useful comments * fix(build): empty interface * chore(comment): removed --------- Co-authored-by: Stan Girard <girard.stanislas@gmail.com>
23 lines
571 B
TypeScript
23 lines
571 B
TypeScript
import { HTMLAttributes } from "react";
|
|
import { UserStats } from "../types";
|
|
|
|
interface DateComponentProps extends HTMLAttributes<HTMLSpanElement> {
|
|
date: UserStats["date"];
|
|
}
|
|
|
|
export const DateComponent = ({
|
|
date,
|
|
...props
|
|
}: DateComponentProps): 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 <span {...props}>{formattedDate}</span>;
|
|
};
|