refactor: 重新调整exam页面
This commit is contained in:
@@ -48,3 +48,14 @@ export function useOptionalInjection<T>(
|
||||
const value = useFn();
|
||||
return value ?? defaultValue;
|
||||
}
|
||||
|
||||
export function formatDate(date: Date | string) {
|
||||
const dateObj = typeof date === "string" ? new Date(date) : date;
|
||||
return dateObj.toLocaleString("zh-CN", {
|
||||
year: "numeric",
|
||||
month: "2-digit",
|
||||
day: "2-digit",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user