fedisearch/application/src/components/feed/badges/CreatedAtBadge.tsx

14 wiersze
468 B
TypeScript
Czysty Zwykły widok Historia

import React, { ReactElement } from 'react'
import { faCalendarPlus } from '@fortawesome/free-solid-svg-icons'
import Badge from './Badge'
2022-01-01 19:37:33 +00:00
export default function CreatedAtBadge ({ createdAt }: { createdAt: string | null }): ReactElement {
2022-01-01 19:37:33 +00:00
return (
<Badge faIcon={faCalendarPlus}
label={'Created at'}
value={createdAt !== null ? (new Date(createdAt)).toLocaleDateString() : null}
className={'created-at'}
/>
2022-01-01 19:37:33 +00:00
)
}