uniapp__微信小程序如何对比时间组件框选中框之后的时间大小

1、时间组件框选择时间

2、做判断 

	if (new Date(selectedDate) < new Date(this.startDate)) {
					uni.showToast({
						title: '结束时间不能早于起始时间',
						icon: 'none',
						duration: 2000
					});
					return;
				}

	console.log(new Date(selectedDate),new Date(this.endDate));

3、打印出来的时间对比 

 

 场景说明:就是两个时间框但是初始时间不能比末尾时间大,所以要比较,new Date(this.endDate),这个传入时间就打印上面的值就直接能比较大小

猜你喜欢

转载自blog.csdn.net/apple_70049717/article/details/141752899