diff --git a/src/utils/formatTime.ts b/src/utils/formatTime.ts index 99eb428..6e4761a 100644 --- a/src/utils/formatTime.ts +++ b/src/utils/formatTime.ts @@ -316,6 +316,19 @@ export function getLast1Year(): [dayjs.ConfigType, dayjs.ConfigType] { return getDateRange(lastYearDay, yesterday) } +export const formatTime = (timestamp?: number) => { + if (!timestamp) return '-' + const d = new Date(timestamp) + const pad = (n: number) => n.toString().padStart(2, '0') + return `${d.getFullYear()}-${pad(d.getMonth()+1)}-${pad(d.getDate())} ` + + `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}` +} + +export const formatDate2 = (date: any) => { + if (!date) return '-' + return formatDate(new Date(date), 'YYYY-MM-DD') +} + /** * 获取指定日期的开始时间、截止时间 * @param beginDate 开始日期 diff --git a/src/views/erp/stock/in/index.vue b/src/views/erp/stock/in/index.vue index 9ba432a..cb3aae3 100644 --- a/src/views/erp/stock/in/index.vue +++ b/src/views/erp/stock/in/index.vue @@ -45,7 +45,7 @@