MCPcopy
hub / github.com/LetTTGACO/elog / timeFormat

Function timeFormat

packages/shared/src/utils/time.ts:34–41  ·  view source on GitHub ↗
(time: any)

Source from the content-addressed store, hash-verified

32 * @param time 时间
33 */
34export const timeFormat = (time: any) => {
35 // 时区,默认 Asia/Shanghai
36 const timezone = process.env.TIME_ZONE || 'Asia/Shanghai'
37 // 格式化,默认YYYY-MM-DD HH:mm:ss
38 const format = process.env.TIME_FORMAT || 'YYYY-MM-DD HH:mm:ss'
39
40 return dayjs(time).tz(timezone).format(format)
41}
42
43export const isTime = (time: any) => {
44 return dayjs(time).isValid()

Callers 7

getPropsFunction · 0.90
getPropsFunction · 0.90
getPropValFunction · 0.90
propsFunction · 0.90
propsFunction · 0.90
getPropValFunction · 0.90
propsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected