//#region src/utils/dates.ts
/** Checks if the provided value is a valid date */
function isValidDate(value) {
	return `${new Date(value)}` !== "Invalid Date";
}
/** Formats the date to ISO format: 'yyyy-mm-dd' */
function formatIsoDate(date) {
	const d = new Date(date);
	if (!isValidDate(d)) return void 0;
	return `${d?.getFullYear()}-${(d.getMonth() + 1).toString().padStart(2, "0")}-${d.getDate().toString().padStart(2, "0")}`;
}
/**
* Parses string date with the iso format of YYYY-mm-dd
* @param input string
* @returns Date | undefined
*/
function parseIsoDate(input) {
	if (!input) return;
	const ticks = Date.parse(input);
	return isNaN(ticks) ? void 0 : new Date(ticks);
}
/**
* Validation for 'YYYY-MM-DD' format
*/
function validateDateFormat(dateString) {
	return dateString.match(/^\d{4}-\d{2}-\d{2}$/);
}
const getDateUTCValue = (date) => ({
	utcYear: date.getUTCFullYear(),
	utcMonth: date.getUTCMonth(),
	utcDate: date.getUTCDate()
});
const generateDateByUTCValue = (year, month, day) => {
	return day ? new Date(Date.UTC(year, month, day)) : new Date(Date.UTC(year, month));
};
const sameYearSameMonth = (a, b) => {
	if (!a || !b) return false;
	return a.getUTCFullYear() === b.getUTCFullYear() && a.getUTCMonth() === b.getUTCMonth();
};
const sameYear = (a, b) => {
	if (!a || !b) return false;
	return a.getUTCFullYear() === b.getUTCFullYear() ? true : false;
};
const sameDate = (a, b) => {
	if (!a || !b) return false;
	return a.getUTCFullYear() === b.getUTCFullYear() && a.getUTCMonth() === b.getUTCMonth() && a.getUTCDate() === b.getUTCDate();
};
const utcDateToLocale = (utcDate) => {
	if (!utcDate) return void 0;
	return new Date(utcDate.getUTCFullYear(), utcDate.getUTCMonth(), utcDate.getUTCDate()).toLocaleDateString();
};
const getCurrentYear = () => {
	return (/* @__PURE__ */ new Date()).getFullYear();
};

//#endregion
export { formatIsoDate, generateDateByUTCValue, getCurrentYear, getDateUTCValue, isValidDate, parseIsoDate, sameDate, sameYear, sameYearSameMonth, utcDateToLocale, validateDateFormat };
globalThis.__vuiVersion__ = "4.0.1"
//# sourceMappingURL=dates.js.map