import { isChinese } from "./localeUtils.js";
//#region src/components/pisellDateTimeDisplay/utils/formatWeekday.ts
/**
* 格式化星期
* @param weekday dayjs 日期对象
* @param config 星期格式配置
* @returns 格式化后的星期字符串
*
* @example
* // 英文环境
* formatWeekday(dayjs(), { full: false, singleLetter: false })
* // => "Sat"
*
* formatWeekday(dayjs(), { full: true })
* // => "Saturday"
*
* formatWeekday(dayjs(), { singleLetter: true })
* // => "S"
*
* // 中文环境
* formatWeekday(dayjs(), { full: false, singleLetter: false })
* // => "周六"
*
* formatWeekday(dayjs(), { full: true })
* // => "星期六"
*
* formatWeekday(dayjs(), { singleLetter: true })
* // => "六"
*/
function formatWeekday(weekday, config) {
	const { full = false, singleLetter = false, trailingComma = false } = config || {};
	const isChinese$1 = isChinese(weekday.locale());
	const appendComma = (s) => trailingComma ? isChinese$1 ? `${s}，` : `${s},` : s;
	if (singleLetter) {
		if (isChinese$1) return appendComma([
			"日",
			"一",
			"二",
			"三",
			"四",
			"五",
			"六"
		][weekday.day()]);
		return appendComma(weekday.format("dd").charAt(0));
	}
	if (full) return appendComma(weekday.format("dddd"));
	return appendComma(weekday.format("ddd"));
}
//#endregion
export { formatWeekday };
