File tree Expand file tree Collapse file tree 1 file changed +27
-11
lines changed Expand file tree Collapse file tree 1 file changed +27
-11
lines changed Original file line number Diff line number Diff line change @@ -192,7 +192,7 @@ export default create({
192192 });
193193
194194 const changeHandler = (val : string []) => {
195- if (props . type == ' datetime' ) {
195+ if ([ ' date ' , ' datetime' ]. includes ( props . type ) ) {
196196 let formatDate = [];
197197 if (props .isShowChinese ) {
198198 formatDate = val .map ((res : string ) => {
@@ -201,16 +201,32 @@ export default create({
201201 } else {
202202 formatDate = val ;
203203 }
204- console .log (formatDate );
205- state .currentDate = formatValue (
206- new Date (
207- formatDate [0 ],
208- formatDate [1 ] - 1 ,
209- formatDate [2 ],
210- formatDate [3 ],
211- formatDate [4 ]
212- )
213- );
204+ let date: Date ;
205+ if (props .type === ' date' ) {
206+ state .currentDate = formatValue (
207+ new Date (
208+ formatDate [0 ],
209+ formatDate [1 ] - 1 ,
210+ Math .min (
211+ formatDate [2 ],
212+ getMonthEndDay (formatDate [0 ], formatDate [1 ])
213+ )
214+ )
215+ );
216+ } else if (props .type === ' datetime' ) {
217+ state .currentDate = formatValue (
218+ new Date (
219+ formatDate [0 ],
220+ formatDate [1 ] - 1 ,
221+ Math .min (
222+ formatDate [2 ],
223+ getMonthEndDay (formatDate [0 ], formatDate [1 ])
224+ ),
225+ formatDate [3 ],
226+ formatDate [4 ]
227+ )
228+ );
229+ }
214230 }
215231 };
216232
You can’t perform that action at this time.
0 commit comments