'use client';
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
import { getObjectDotNotation } from 'payload/shared';
import React from 'react';
import { useConfig } from '../../../../../providers/Config/index.js';
import { useTranslation } from '../../../../../providers/Translation/index.js';
import { formatDate } from '../../../../../utilities/formatDocTitle/formatDateTitle.js';
export const DateCell = (props)=>{
    const { cellData, field: { name, accessor, admin: { date } = {}, timezone: timezoneFromField }, rowData } = props;
    const { config: { admin: { dateFormat: dateFormatFromRoot } } } = useConfig();
    const { i18n } = useTranslation();
    const fieldPath = accessor || name;
    const timezoneFieldName = `${fieldPath}_tz`;
    const timezone = Boolean(timezoneFromField) && rowData ? getObjectDotNotation(rowData, timezoneFieldName, undefined) : undefined;
    const dateFormat = date?.displayFormat || dateFormatFromRoot;
    return /*#__PURE__*/ _jsxDEV("span", {
        children: Boolean(cellData) && formatDate({
            date: cellData,
            i18n,
            pattern: dateFormat,
            timezone
        })
    }, void 0, false, {
        fileName: "src/elements/Table/DefaultCell/fields/Date/index.tsx",
        lineNumber: 38,
        columnNumber: 5
    }, this);
};

//# sourceMappingURL=index.js.map