From 71972694f7d5f23cf42226366a9ddaad4b72b89f Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期五, 20 九月 2024 09:33:06 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ycl-server/src/main/java/com/ycl/utils/DateUtils.java |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/ycl-server/src/main/java/com/ycl/utils/DateUtils.java b/ycl-server/src/main/java/com/ycl/utils/DateUtils.java
index b685b27..d1e6846 100644
--- a/ycl-server/src/main/java/com/ycl/utils/DateUtils.java
+++ b/ycl-server/src/main/java/com/ycl/utils/DateUtils.java
@@ -1,6 +1,7 @@
 package com.ycl.utils;
 
 import org.apache.commons.lang3.time.DateFormatUtils;
+import org.glassfish.jaxb.core.v2.TODO;
 
 import javax.annotation.Nullable;
 import java.lang.management.ManagementFactory;
@@ -232,10 +233,13 @@
     /**
      * 鑾峰彇鏌愭湀寮�濮嬫棩鏈�
      */
+    //TODO:鏍¢獙閫昏緫鏄惁姝g‘
     public static String getMouthStart(@Nullable Date date) {
         SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
         Calendar c = Calendar.getInstance();
-        c.add(Calendar.MONTH, 0);
+        if (date != null) {
+            c.setTime(date); // 濡傛灉date涓嶄负null锛屽垯璁剧疆Calendar鐨勬棩鏈熶负date
+        }
         c.set(Calendar.DAY_OF_MONTH,1);
         return df.format(c.getTime());
     }
@@ -246,6 +250,9 @@
     public static String getMouthEnd(@Nullable Date date) {
         SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
         Calendar c = Calendar.getInstance();
+        if (date != null) {
+            c.setTime(date); // 濡傛灉date涓嶄负null锛屽垯璁剧疆Calendar鐨勬棩鏈熶负date
+        }
         c.set(Calendar.DAY_OF_MONTH, c.getActualMaximum(Calendar.DAY_OF_MONTH));
         return df.format(c.getTime());
     }

--
Gitblit v1.8.0