hookehuyr

🐞 fix(日期时间组件): 最大最小值设置,需要区分日期格式

...@@ -158,11 +158,19 @@ onMounted(() => { ...@@ -158,11 +158,19 @@ onMounted(() => {
158 // 设置默认最大最小日期 158 // 设置默认最大最小日期
159 if (data_minvalue.split(" ")[0].length) { 159 if (data_minvalue.split(" ")[0].length) {
160 const min = data_minvalue.split(" ")[0].split("-") 160 const min = data_minvalue.split(" ")[0].split("-")
161 - minDate.value = new Date(+min[0], +min[1] - 1, +min[2]) 161 + if (date_format === 'YYYY-MM') {
162 + minDate.value = new Date(+min[0], +min[1] - 1)
163 + } else {
164 + minDate.value = new Date(+min[0], +min[1] - 1, +min[2])
165 + }
162 } 166 }
163 if (data_maxvalue.split(" ")[0].length) { 167 if (data_maxvalue.split(" ")[0].length) {
164 const max = data_maxvalue.split(" ")[0].split("-") 168 const max = data_maxvalue.split(" ")[0].split("-")
165 - maxDate.value = new Date(+max[0], +max[1] - 1, +max[2]) 169 + if (date_format === 'YYYY-MM') {
170 + maxDate.value = new Date(+max[0], +max[1] - 1)
171 + } else {
172 + maxDate.value = new Date(+max[0], +max[1] - 1, +max[2])
173 + }
166 } 174 }
167 }); 175 });
168 176
......