mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-16 01:01:38 +00:00
21 lines
405 B
TypeScript
21 lines
405 B
TypeScript
import { FC } from 'react';
|
|
import { parseISO, format } from 'date-fns';
|
|
import { Box } from '@chakra-ui/react';
|
|
|
|
interface Props {
|
|
dateString: string;
|
|
}
|
|
|
|
const Date: FC<Props> = ({ dateString }) => {
|
|
const date = parseISO(dateString);
|
|
return (
|
|
<>
|
|
<Box as="time" lineHeight="0" dateTime={dateString}>
|
|
{format(date, 'yyyy/MM/dd')}
|
|
</Box>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default Date;
|