From 1ed615611768274cfc260ed4e65b7ae6bd43c36f Mon Sep 17 00:00:00 2001 From: dj <1042039504@qq.com> Date: Thu, 12 Jun 2025 12:08:41 +0800 Subject: [PATCH 1/2] =?UTF-8?q?build(deps):=20=E5=88=A0=E9=99=A4=20moment?= =?UTF-8?q?=20=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 - src/views/workflow/form/utils/date.js | 57 +++++++++++++-------------- 2 files changed, 28 insertions(+), 30 deletions(-) diff --git a/package.json b/package.json index 39ee098..f2404dc 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,6 @@ "highlight.js": "9.18.5", "jquery": "^3.6.0", "js-cookie": "^3.0.5", - "moment": "^2.30.1", "nprogress": "^0.2.0", "pinia": "^2.0.35", "sass": "^1.62.1", diff --git a/src/views/workflow/form/utils/date.js b/src/views/workflow/form/utils/date.js index f75e3cd..dc12030 100644 --- a/src/views/workflow/form/utils/date.js +++ b/src/views/workflow/form/utils/date.js @@ -1,5 +1,4 @@ //时间转换为String类型 -const moment = require("moment"); function simpleDateFormat(pattern) { var fmt = new Object(); @@ -83,36 +82,36 @@ function consumingTime(dateBegin, dateEnd) { return dayDiff + "天 " + hours + "小时 " + minutes + " 分钟" + seconds + " 秒"; } -export function timeLength(start, dateEnd) { - // //如果时间格式是正确的,那下面这一步转化时间格式就可以不用了 - let mstart = moment(start); - let mend = moment(dateEnd); - let years = mend.diff(start, "years"); - let months = mend.diff(start, "months"); - let days = mend.diff(start, "days"); - let hours = mend.diff(start, "hours"); - let minutes = mend.diff(start, "minutes"); - minutes = minutes % 60; - hours = hours % 24; - months = months % 12; - //因为每月天不固定,所以天要特殊动态处理 - if (mstart.date() < mend.date()) { - days = mend.date() - mstart.date(); - if (minutes > 0 || hours > 0) { - days--; - } - } - //处理超过俩月且天超过31 - if (days > 31 && mend.month() - mstart.month() >= 2) { - //将日期推至上月求差 - days = mend.diff(mstart.add(mend.month() - mstart.month() - 1, "month"), "days"); - } - return `${years > 0 ? years + "年 " : " "}` + `${months > 0 ? months + "个月 " : " "}` + `${days > 0 ? days + "天 " : " "}` - + `${hours > 0 ? hours + "小时 " : " "}` + `${minutes > 0 ? minutes + "分钟 " : " "}`; -} +// export function timeLength(start, dateEnd) { +// // //如果时间格式是正确的,那下面这一步转化时间格式就可以不用了 +// let mstart = moment(start); +// let mend = moment(dateEnd); +// let years = mend.diff(start, "years"); +// let months = mend.diff(start, "months"); +// let days = mend.diff(start, "days"); +// let hours = mend.diff(start, "hours"); +// let minutes = mend.diff(start, "minutes"); +// minutes = minutes % 60; +// hours = hours % 24; +// months = months % 12; +// //因为每月天不固定,所以天要特殊动态处理 +// if (mstart.date() < mend.date()) { +// days = mend.date() - mstart.date(); +// if (minutes > 0 || hours > 0) { +// days--; +// } +// } +// //处理超过俩月且天超过31 +// if (days > 31 && mend.month() - mstart.month() >= 2) { +// //将日期推至上月求差 +// days = mend.diff(mstart.add(mend.month() - mstart.month() - 1, "month"), "days"); +// } +// return `${years > 0 ? years + "年 " : " "}` + `${months > 0 ? months + "个月 " : " "}` + `${days > 0 ? days + "天 " : " "}` +// + `${hours > 0 ? hours + "小时 " : " "}` + `${minutes > 0 ? minutes + "分钟 " : " "}`; +// } module.exports = { formatToYYYYMMDD: simpleDateFormatByMoreLine, consumingTime: consumingTime, - timeLength: timeLength + // timeLength: timeLength } From 560bea739c55070881599d5f13be364311db6a45 Mon Sep 17 00:00:00 2001 From: dj <1042039504@qq.com> Date: Thu, 12 Jun 2025 14:07:25 +0800 Subject: [PATCH 2/2] =?UTF-8?q?test=20:=20=E6=B5=8B=E8=AF=95cicd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/workflow/form/components/DateTimeRange.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/views/workflow/form/components/DateTimeRange.vue b/src/views/workflow/form/components/DateTimeRange.vue index cfd9099..78608a7 100644 --- a/src/views/workflow/form/components/DateTimeRange.vue +++ b/src/views/workflow/form/components/DateTimeRange.vue @@ -34,7 +34,6 @@ -