MCPcopy Create free account
hub / github.com/ModelEngine-Group/app-platform / formatDateTime

Function formatDateTime

frontend/src/shared/utils/function.ts:2–13  ·  view source on GitHub ↗
(dateString: Date)

Source from the content-addressed store, hash-verified

1// 日期方法
2export const formatDateTime = (dateString: Date) => {
3 let date = dateString;
4 const year = date.getFullYear();
5 const month = date.getMonth() + 1;
6 const day = date.getDate();
7 const hour = date.getHours();
8 const minute = date.getMinutes();
9 const second = date.getSeconds();
10 return `${year}-${pad(month)}-${pad(day)} ${pad(hour)}:${pad(minute)}:${pad(
11 second
12 )}`;
13}
14function pad(num: number) {
15 return num.toString().padStart(2, '0');
16}

Callers

nothing calls this directly

Calls 1

padFunction · 0.70

Tested by

no test coverage detected