Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
49 lines
1.3 KiB
Plaintext
49 lines
1.3 KiB
Plaintext
'use client';
|
|
|
|
import { jsx as _jsx } from "react/jsx-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: t0,
|
|
rowData
|
|
} = props;
|
|
const {
|
|
name,
|
|
accessor,
|
|
admin: t1,
|
|
timezone: timezoneFromField
|
|
} = t0;
|
|
const {
|
|
date
|
|
} = t1 === undefined ? {} : t1;
|
|
const {
|
|
config: t2
|
|
} = useConfig();
|
|
const {
|
|
admin: t3
|
|
} = t2;
|
|
const {
|
|
dateFormat: dateFormatFromRoot
|
|
} = t3;
|
|
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 _jsx("span", {
|
|
children: Boolean(cellData) && formatDate({
|
|
date: cellData,
|
|
i18n,
|
|
pattern: dateFormat,
|
|
timezone
|
|
})
|
|
});
|
|
};
|
|
//# sourceMappingURL=index.js.map |