import dayjs from 'dayjs';
const DEFAULT_DATE_FORMAT_CONF = {
    s: 'YYYY-MM-DD HH:mm:ss',
    m: 'YYYY-MM-DD HH:mm',
    H: 'YYYY-MM-DD HH',
    D: 'YYYY-MM-DD',
    M: 'YYYY-MM',
    W: 'gggg-wo',
    Q: 'YYYY-[Q]Q',
    Y: 'YYYY',
    HH: 'HH',
    Hm: 'HH:mm',
    Hms: 'HH:mm:ss',
};
export const getDateFormatConf = (_adapterLocale) => {
    // TODO: 按 adapterLocale 返回对应语言的格式配置
    return DEFAULT_DATE_FORMAT_CONF;
};
export const dateFormatStr = (num, formatStr, adapterLocale) => {
    if (!num)
        return;
    if (!adapterLocale)
        return dayjs(num).format(formatStr);
    const formats = getDateFormatConf(adapterLocale);
    const formatConfStds = getDateFormatConf('zh-CN');
    const key = Object.keys(formatConfStds).find((k) => formatConfStds[k] === formatStr);
    const formatStrFinal = key ? formats[key] || formatStr : formatStr;
    return dayjs(num).format(formatStrFinal);
};
