"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.dateFormatStr = exports.getDateFormatConf = void 0;
const dayjs_1 = __importDefault(require("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',
};
const getDateFormatConf = (_adapterLocale) => {
    // TODO: 按 adapterLocale 返回对应语言的格式配置
    return DEFAULT_DATE_FORMAT_CONF;
};
exports.getDateFormatConf = getDateFormatConf;
const dateFormatStr = (num, formatStr, adapterLocale) => {
    if (!num)
        return;
    if (!adapterLocale)
        return (0, dayjs_1.default)(num).format(formatStr);
    const formats = (0, exports.getDateFormatConf)(adapterLocale);
    const formatConfStds = (0, exports.getDateFormatConf)('zh-CN');
    const key = Object.keys(formatConfStds).find((k) => formatConfStds[k] === formatStr);
    const formatStrFinal = key ? formats[key] || formatStr : formatStr;
    return (0, dayjs_1.default)(num).format(formatStrFinal);
};
exports.dateFormatStr = dateFormatStr;
