import { PreviewComponentProps } from "../internal" ; import React from "react" ; import format from "date-fns/format" ; import * as locales from "date-fns/locale" ; import { defaultDateFormat } from "../../core/util/dates" ; import { FireCMSContext } from "../../models" ; import { useFireCMSContext } from "../../hooks" ; category export function TimestampPreview ( { name , value , property , size } ) { const appConfig = useFireCMSContext ( ) ; const dateUtilsLocale = appConfig ?. locale ? locales [ appConfig ?. locale ] : undefined ; const dateFormat = appConfig ?. dateTimeFormat ?? defaultDateFormat ; const formattedDate = value ? format ( value , dateFormat , { locale : dateUtilsLocale } ) : "" ; return ( < > { formattedDate } < />); }