import { Text } from "@chakra-ui/react" import type {Dayjs} from 'dayjs'; import dayjs from 'dayjs'; import { shortTodayAwareFormat } from "../../core/TimeUtils"; import type {ComponentProps} from "react"; export type DateDisplayProps = { date?: string | Dayjs prefix?: string } & ComponentProps export const ShortDateDisplay = (props: DateDisplayProps) => { const { date, prefix, ...rest } = props; if(date === undefined) { return (No Date) } return {`${prefix !== undefined ? `${prefix} ` : ''}${shortTodayAwareFormat(typeof date === 'string' ? dayjs(date) : date)}`} }