Download next.js/examples/cms-kontent-ai/components/date-formatter.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 347 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/examples/cms-kontent-ai/components/date-formatter.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/examples/cms-kontent-ai/components/date-formatter.tsx
-
curl -L -o date-formatter.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/examples/cms-kontent-ai/components/date-formatter.tsx
347 Bytes
| import { parseISO, format } from "date-fns"; | |
| type DateFormatterProps = { dateString: string | null }; | |
| export default function DateFormatter({ dateString }: DateFormatterProps) { | |
| if (dateString === null) { | |
| return <></>; | |
| } | |
| const date = parseISO(dateString); | |
| return <time dateTime={dateString}>{format(date, "LLLL d, yyyy")}</time>; | |
| } | |