//#region src/utils/formatDate.ts
/** Predefined selection of date formats using DateTimeFormatOptions. */
const dateFormats = {
	"DD MM YYYY": {
		year: "numeric",
		month: "2-digit",
		day: "2-digit"
	},
	"DD MM YYYY, HH:MM": {
		year: "numeric",
		month: "2-digit",
		day: "2-digit",
		hour: "2-digit",
		minute: "2-digit"
	},
	"DD MMM": {
		month: "short",
		day: "2-digit"
	},
	"DD MMM YYYY": {
		year: "numeric",
		month: "short",
		day: "2-digit"
	},
	"DD MMM YYYY, HH:MM": {
		year: "numeric",
		month: "short",
		day: "2-digit",
		hour: "2-digit",
		minute: "2-digit"
	},
	"DD MMM, HH:MM": {
		month: "short",
		day: "2-digit",
		hour: "2-digit",
		minute: "2-digit"
	},
	"HH:MM": {
		locales: "en-GB",
		hour: "2-digit",
		minute: "2-digit",
		hourCycle: "h23"
	},
	"MMM D, YYYY": {
		locales: "en-US",
		year: "numeric",
		month: "short",
		day: "numeric"
	},
	"YYYY/MM/DD": { locales: "en-ZA" },
	"YYYY-MM-DD": { locales: "fr-CA" },
	"YYYY/MM/DD, HH:MM": {
		locales: "en-ZA",
		hour: "2-digit",
		minute: "2-digit"
	},
	"YYYY-MM-DD, HH:MM": {
		locales: "fr-CA",
		timeStyle: "short"
	},
	"YYYY-MM-DD, HH:MM:SS": { locales: "fr-CA" }
};
/**
* Structures given date string, milliseconds number or Date object according to the chosen format.
* Uses toLocalDateString internally. Predefined formats specify initial options, which can be overwritten.
* @param date - string, number or Date object accepted by Date() constructor
* @param format - predefined configuration of DateTimeFormatOptions
* @param options - configuration of toLocaleDateString method
*/
function formatDate(date, format = "DD MM YYYY", options) {
	const { locales, ...mergedOptions } = {
		...dateFormats[format],
		...options
	};
	if (format === "YYYY-MM-DD, HH:MM:SS" || format === "YYYY-MM-DD, HH:MM") return date ? new Date(date).toLocaleDateString(locales) + ", " + new Date(date).toLocaleTimeString(void 0, mergedOptions) : "";
	if (format === "HH:MM") return date ? new Date(date).toLocaleTimeString(locales, mergedOptions) : "";
	return date ? new Date(date).toLocaleDateString(locales, mergedOptions) : "";
}

//#endregion
export { dateFormats, formatDate };
globalThis.__vuiVersion__ = "4.0.1"
//# sourceMappingURL=formatDate.js.map