From 6c40e04eb7c2060feb2533735cd3089d438965e5 Mon Sep 17 00:00:00 2001
From: nidapeng <jp@doumee.com>
Date: 星期二, 19 三月 2024 17:19:36 +0800
Subject: [PATCH] 整理
---
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