/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-e634e55 | Cube Dev Team */
import { parseAbsolute } from "@internationalized/date";

//#region src/components/fields/DatePicker/parseDate.ts
function parseAbsoluteDate(val) {
	if (!val || typeof val === "string" && val.trim() === "") return;
	if (val instanceof Date) return parseAbsolute(val.toISOString(), "UTC");
	try {
		parseAbsolute(val, "UTC");
	} catch (e) {
		if (!Number.isNaN(Date.parse(val))) return parseAbsolute(new Date(val).toISOString(), "UTC");
		else {
			console.error("Invalid date format", val);
			return;
		}
	}
}

//#endregion
export { parseAbsoluteDate };
//# sourceMappingURL=parseDate.js.map