import { getObjectDotNotation } from 'payload/utilities';
import { formatDate } from './formatDate/index.js';
export const formatDocTitle = (args)=>{
    const { dateFormat, doc, field: fieldFromProps, i18n, isDate, useAsTitle } = args;
    if (!fieldFromProps && !doc) {
        return '';
    }
    const field = fieldFromProps || getObjectDotNotation(doc, useAsTitle);
    let title;
    if (typeof field === 'string') {
        title = field;
    } else if (typeof field === 'number') {
        title = String(field);
    } else {
        title = field?.value;
    }
    if (title && isDate) {
        title = formatDate(title, dateFormat, i18n.language);
    }
    return title;
};

//# sourceMappingURL=formatDocTitle.js.map