From a25e34a84abe514f6e6bf39781c337eea1fd01d3 Mon Sep 17 00:00:00 2001 From: 鲁班七号 <9159450+luban-71@user.noreply.gitee.com> Date: 星期一, 09 一月 2023 11:05:47 +0800 Subject: [PATCH] 优化注册 --- src/filters/index.js | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/src/filters/index.js b/src/filters/index.js index 79f8467..c8a1b4e 100644 --- a/src/filters/index.js +++ b/src/filters/index.js @@ -19,6 +19,27 @@ } } +// 时间戳过滤器 +export function formatDate(value) { + if (!value){ + return "---" + }else{ + let date = new Date(value); + let month = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1); + let day = (date.getDate()+1 < 10 ? '0'+(date.getDate()) : date.getDate()); + let hours = date.getHours(); + if (hours < 10) + hours = "0" + hours; + let minutes = date.getMinutes(); + if (minutes < 10) + minutes = "0" + minutes; + let time = date.getFullYear() + "-" + month + "-" + day + + " " + hours +":" + minutes ; + // + hours + ":" + minutes + return time; + } +} + /* 数字 格式化*/ export function numberFormatter(num, digits) { const si = [ -- Gitblit v1.9.2