"use client";
import { useLocaleContext } from "./use-locale-context.js";
import { useMemo } from "react";
import { DateFormatter } from "@internationalized/date";
//#region src/providers/locale/use-date-formatter.ts
function useDateFormatter(props = {}) {
	const env = useLocaleContext();
	const locale = props.locale ?? env.locale;
	return useMemo(() => {
		const { locale: _, ...options } = props;
		return new DateFormatter(locale, options);
	}, [locale, props]);
}
//#endregion
export { useDateFormatter };
