import formatDate from 'date-fns/format';
const FORMAT_MAP = {
    second: 'yyyy-LL-dd HH:mm:ss',
    minute: 'yyyy-LL-dd HH:mm',
    hour: 'yyyy-LL-dd HH:00',
    day: 'yyyy-LL-dd',
    week: "yyyy-LL-dd 'W'w",
    month: 'yyyy LLL',
    quarter: 'yyyy QQQ',
    year: 'yyyy',
};
export function formatDateByGranularity(timestamp, granularity) {
    return formatDate(timestamp, FORMAT_MAP[granularity ?? 'second'] ??
        FORMAT_MAP['second']);
}
export function formatDateByPattern(timestamp, format) {
    return formatDate(timestamp, format ?? FORMAT_MAP['second']);
}
//# sourceMappingURL=format-date-by-granularity.js.map