From 50b49c1b760489c3430fc382656d57c5fbbab07c Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 29 四月 2024 16:07:24 +0800
Subject: [PATCH] 2024-04-29

---
 src/tabviews/zshare/topSearch/mkDatePicker/index.jsx |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/tabviews/zshare/topSearch/mkDatePicker/index.jsx b/src/tabviews/zshare/topSearch/mkDatePicker/index.jsx
index fc67c7d..3ec9b43 100644
--- a/src/tabviews/zshare/topSearch/mkDatePicker/index.jsx
+++ b/src/tabviews/zshare/topSearch/mkDatePicker/index.jsx
@@ -54,10 +54,21 @@
     const { config } = this.props
 
     if (config.checkShift && nextProps.config.initval && nextProps.config.initval !== config.initval) {
-      let val = nextProps.config.initval.split(',')
+      let value = nextProps.config.initval || null
+
+      if (this.state.mode === 'daterange') {
+        if (value) {
+          let val = value.split(',')
+          value = [moment(val[0], this.state.format), moment(val[1], this.state.format)]
+        } else {
+          value = [null, null]
+        }
+      } else if (value) {
+        value = moment(value, this.state.format)
+      }
 
       this.setState({
-        value: [moment(val[0], config.format), moment(val[1], config.format)]
+        value: value
       })
 
       this.props.onChange(nextProps.config.initval, true)

--
Gitblit v1.8.0