Files
yphsalumni.org/app/composables/useChineseDateFormat.ts
2025-10-01 16:52:52 +08:00

10 lines
344 B
TypeScript

export const useChineseDateFormat = (input: Date | string) => {
const date = input instanceof Date ? input : new Date(input);
const y = date.getFullYear();
const m = String(date.getMonth() + 1).padStart(2, "0");
const d = String(date.getDate()).padStart(2, "0");
// 返回一个响应式值
return ref(`${y}${m}${d}`);
};