OAFRONT4 清理PC付款和工作台文案
这个提交包含在:
@@ -0,0 +1,32 @@
|
||||
export function formatDisplayDate(value: string | null | undefined) {
|
||||
if (!value) return "-";
|
||||
|
||||
const match = /^(\d{4})-(\d{2})-(\d{2})/.exec(value);
|
||||
if (match) {
|
||||
const [, year, month, day] = match;
|
||||
return `${Number(year)}年${Number(month)}月${Number(day)}日`;
|
||||
}
|
||||
|
||||
const timestamp = new Date(value).getTime();
|
||||
if (Number.isNaN(timestamp)) return "-";
|
||||
return new Intl.DateTimeFormat("zh-CN", {
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
}).format(timestamp);
|
||||
}
|
||||
|
||||
export function formatDisplayDateTime(value: string | null | undefined) {
|
||||
if (!value) return "-";
|
||||
|
||||
const timestamp = new Date(value).getTime();
|
||||
if (Number.isNaN(timestamp)) return formatDisplayDate(value);
|
||||
|
||||
return new Intl.DateTimeFormat("zh-CN", {
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
}).format(timestamp);
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户