import { invariant, PartitionPattern, TimeClip } from "@formatjs/ecma402-abstract";
import { FormatDateTimePattern } from "./FormatDateTimePattern.js";
import "./ToLocalTime.js";
/**
* https://tc39.es/ecma402/#sec-partitiondatetimepattern
* @param dtf
* @param x
*/
export function PartitionDateTimePattern(dtf, x, implDetails) {
	x = TimeClip(x);
	invariant(!x.isNaN(), "Invalid time", RangeError);
	/** IMPL START */
	const { getInternalSlots } = implDetails;
	const internalSlots = getInternalSlots(dtf);
	/** IMPL END */
	const { pattern } = internalSlots;
	return FormatDateTimePattern(dtf, PartitionPattern(pattern), x, implDetails);
}
