export const RESERVE_MINUTE_STEP = 5 export const getNearestFutureDateTime = (stepMinutes = RESERVE_MINUTE_STEP): string => { const now = new Date() const remainder = now.getMinutes() % stepMinutes if (remainder !== 0) { now.setMinutes(now.getMinutes() + (stepMinutes - remainder)) } now.setSeconds(0, 0) const year = now.getFullYear() const month = String(now.getMonth() + 1).padStart(2, '0') const day = String(now.getDate()).padStart(2, '0') const hour = String(now.getHours()).padStart(2, '0') const minute = String(now.getMinutes()).padStart(2, '0') return `${year}-${month}-${day}T${hour}:${minute}` } const KST_DATE_TIME_FORMAT = new Intl.DateTimeFormat('sv-SE', { timeZone: 'Asia/Seoul', year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false, }) // 날짜·시각 선택값(로컬 시각)을 예약 발송 sendDt 형식(KST "yyyy-MM-dd HH:mm:ss")으로 바꾼다. // 이메일·문자·알림톡 공통 형식이다. export const toReserveSendDt = (localDateTime: string): string => KST_DATE_TIME_FORMAT.format(new Date(localDateTime))