export function formatDate(date) {
    const year = date.getFullYear()
    const month = String(date.getMonth() + 1).padStart(2, '0')
    // 월은 0부터 시작
    const day = String(date.getDate()).padStart(2, '0')
    return `${year}-${month}-${day}`
}

export function formatBizNum(num){
    if (!num) return ''

    const raw = num.replace(/\D/g, '') // 숫자만 남김

    // 123 -> 123
    if (raw.length <= 3) return raw
    // 12345 -> 123-45
    if (raw.length <= 5) return raw.replace(/^(\d{3})(\d{0,2})$/, '$1-$2')
    // 1234567890 -> 123-45-67890
    return raw.replace(/^(\d{3})(\d{2})(\d{0,5})$/, '$1-$2-$3')
}