import { CalendarDate, type DateValue, fromDate, toCalendarDate } from '@internationalized/date';

const TIMEZONE = 'Asia/Seoul';

export function dateToCalendarDate(date: Date | null): CalendarDate | null {
  if (!date) return null;
  return toCalendarDate(fromDate(date, TIMEZONE));
}

export function calendarDateToDate(value: DateValue | null): Date | null {
  if (!value) return null;
  return value.toDate(TIMEZONE);
}
