import { CalendarDate, CalendarDateTime, fromAbsolute, getLocalTimeZone, Time, ZonedDateTime } from "@internationalized/date" export { CalendarDate, CalendarDateTime, fromAbsolute, getLocalTimeZone, Time, ZonedDateTime } from "@internationalized/date" export type ParseMode = typeof ZonedDateTime | typeof CalendarDate | typeof CalendarDateTime | typeof Time export type TimeMode = Exclude export type DateMode = Exclude export function parseTime(ms: number, type?: T): InstanceType { if (type === ZonedDateTime) return fromAbsolute(ms, getLocalTimeZone()) as InstanceType const date = new Date(ms) const year = date.getFullYear() const month = date.getMonth() + 1 const day = date.getDate() const hour = date.getHours() const minute = date.getMinutes() const second = date.getSeconds() const millisecond = date.getMilliseconds() if (type === CalendarDate) return new CalendarDate(year, month, day) as InstanceType if (type === Time) return new Time(hour, minute, second, millisecond) as InstanceType return new CalendarDateTime(year, month, day, hour, minute, second, millisecond) as InstanceType }