uView的u-datetime-picker限制开始的年月日后ios显示不出来

解决方法:


				
				
				
			
			
				
				
			

maxdate() {
				let currentDate = new Date();
				let year = currentDate.getFullYear();
				let month = ("0" + (currentDate.getMonth() + 1)).slice(-2);
				let day = ("0" + currentDate.getDate()).slice(-2);
				// 设置当前日期为下个月的第一天
				let firstDayOfNextMonth = new Date(year, month, 1);
				// 获取当前月份的最后一天
				let lastDayOfMonth = new Date(firstDayOfNextMonth.getTime() - 1);
				let lastDay = lastDayOfMonth.getDate();
				// if (Number(day) + 3 > lastDay) {
				// 	month =  month * 1 + 1
				// 	day =  Math.abs(day - lastDay);
				// } else {
				// 	day = Number(day) + 3
				// }
				if (uni.getSystemInfoSync().platform == 'ios') {
					if (Number(day) + 3 > lastDay) {
						month = month * 1 + 1
						day = Math.abs(day - lastDay);
					} else {
						day = Number(day) + 3
					}
					let ss = year + '/' + month + '/' + day + ' ' + '23:59:59'
					return Date.parse(ss);
				}
				if(uni.getSystemInfoSync().platform == 'android') {
					if (Number(day) + 3 > lastDay) {
						month = month * 1 + 1
						day = Math.abs(day - lastDay);
					} else {
						day = Number(day) + 3
					}
					let ss = year + '-' + month + '-' + day + ' ' + '23:59:59'
					return Date.parse(ss);
				}

			},
			maxdateOne() {
				if (this.model.sqrxrq) {
					let ss = this.model.sqrxrq.slice(0, 10);
					let ff = ss + ' ' + '23:59:59'
					return Date.parse(ff);
				}
			},
			mindate() {
				let currentDate = new Date();
				let year = currentDate.getFullYear();
				let month = ("0" + (currentDate.getMonth() + 1)).slice(-2);
				let day = ("0" + currentDate.getDate()).slice(-2);

				let ss = year + '-' + month + '-' + day + ' ' + '00:00:00'
				return Date.parse(ss);
			},
			mindateOne() {
				if (this.model.sqrxrq) {
					return Date.parse(this.model.sqrxrq);
				}
			},

你可能感兴趣的:(ios)