From 783ce26ca70a54deb98c6644a911df88021ee28f Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期二, 12 三月 2024 09:41:53 +0800
Subject: [PATCH] mrshi
---
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