From 46d3620740d3dffee104171b3edf1ca6b92cece1 Mon Sep 17 00:00:00 2001 From: k94314517 <8417338+k94314517@user.noreply.gitee.com> Date: 星期日, 17 三月 2024 18:11:12 +0800 Subject: [PATCH] ERP接口 --- h5/utils/utils.js | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-) diff --git a/h5/utils/utils.js b/h5/utils/utils.js index a499c7f..5c30af7 100644 --- a/h5/utils/utils.js +++ b/h5/utils/utils.js @@ -50,6 +50,18 @@ let d2 = Date.parse(new Date(endDdate)); // 鏃堕棿鎴崇浉鍑� / 澶╂暟 let day = parseInt((d2 - d1) / (1000 * 60 * 60 * 24)); - console.log(day) return day +} + +// 鑾峰彇澶氬皯澶╁悗鐨勬棩鏈� +export const getDaysAfterDate = (date, days) => { + if (days === 0) { + return '2099-01-01' + } + const now = new Date(date); + now.setDate(now.getDate() + days); + const year = now.getFullYear(); + const month = now.getMonth() + 1; // 鏈堜唤鏄粠0寮�濮嬬殑 + const day = now.getDate(); + return `${year}-${month.toString().padStart(2, '0')}-${day.toString().padStart(2, '0')}`; } \ No newline at end of file -- Gitblit v1.9.3