initial commit
This commit is contained in:
9
app/composables/useChineseDateFormat.ts
Normal file
9
app/composables/useChineseDateFormat.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
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}日`);
|
||||
};
|
||||
Reference in New Issue
Block a user