更新 UI 一致性規範與公共事業費樣式
All checks were successful
Koori-ERP-Deploy-System / deploy-demo (push) Successful in 47s
Koori-ERP-Deploy-System / deploy-production (push) Has been skipped

This commit is contained in:
2026-01-20 10:41:35 +08:00
parent 32c2612a5f
commit c1d302f03e
6 changed files with 233 additions and 84 deletions

View File

@@ -24,6 +24,32 @@ export const formatDate = (date: string): string => {
return new Date(date).toLocaleDateString("zh-TW");
};
/**
* 格式化日期並包含星期
*/
export const formatDateWithDayOfWeek = (date: string): string => {
if (!date) return "-";
return new Date(date).toLocaleDateString("zh-TW", {
year: "numeric",
month: "2-digit",
day: "2-digit",
weekday: "short",
});
};
/**
* 格式化發票號碼
* 例如AB12345678 -> AB-12345678
*/
export const formatInvoiceNumber = (invoice: string | null | undefined): string => {
if (!invoice) return "-";
const cleanInvoice = invoice.replace(/-/g, "");
if (/^[a-zA-Z]{2}\d+$/.test(cleanInvoice)) {
return `${cleanInvoice.slice(0, 2).toUpperCase()}-${cleanInvoice.slice(2)}`;
}
return invoice;
};
/**
* 獲取當前日期YYYY-MM-DD 格式)
*/