import { isValid } from "date-fns";
export const splitIso8601DateTime = (isoString) => {
    const [datePart, timePart] = isoString.split("T");
    return {
        date: datePart,
        time: timePart,
    };
};
const splitDateTime = (value) => {
    const defaultResult = { date: "", time: "" };
    if (!value) {
        return defaultResult;
    }
    if (typeof value === "string") {
        const { date, time } = splitIso8601DateTime(value);
        return { date, time };
    }
    if (isValid(value)) {
        const dateString = value.toISOString();
        const { date, time } = splitIso8601DateTime(dateString);
        return { date, time };
    }
    return defaultResult;
};
export const getDateFromValue = (value) => {
    const { date } = splitDateTime(value);
    return date;
};
//# sourceMappingURL=date-picker.js.map