const require_objectSpread2 = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_formatDate = require("./formatDate.js");
const require_formatWeekday = require("./formatWeekday.js");
const require_relativeDay = require("./relativeDay.js");
//#region src/components/pisellDateTimeDisplay/utils/formatDateOrRelative.ts
/**
* 获取「日期部分」的展示文案（相对日内置在 datetime）
* - 若开启 showRelativeDay 且日期为今天/昨天/明天，返回相对日文案（如「今天」「Yesterday」）
* - 否则返回「星期, 日期」格式（用于时间区间跨天等场景）
*
* 供 PisellDateTimeDisplay、PisellTimeRangeDisplay 等统一使用，相对时间逻辑只在此处维护
*/
function getDatePartDisplay(params) {
	const { date, dateFormat, weekdayFormat, referenceDate, dateFormatOverride } = params;
	if (dateFormat === null || dateFormat === void 0 ? void 0 : dateFormat.showRelativeDay) {
		const rel = require_relativeDay.getRelativeDay(date, referenceDate);
		if (rel) {
			var _labels$rel;
			const labels = dateFormat.relativeDayLabels;
			return (_labels$rel = labels === null || labels === void 0 ? void 0 : labels[rel]) !== null && _labels$rel !== void 0 ? _labels$rel : require_relativeDay.getRelativeDayLabel(rel, date.locale());
		}
	}
	const mergedDateConfig = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, dateFormat), dateFormatOverride);
	return `${require_formatWeekday.formatWeekday(date, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, weekdayFormat), {}, { trailingComma: true }))} ${require_formatDate.formatDate(date, mergedDateConfig)}`;
}
//#endregion
exports.getDatePartDisplay = getDatePartDisplay;
