You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					38 lines
				
				717 B
			
		
		
			
		
	
	
					38 lines
				
				717 B
			| 
								 
											2 years ago
										 
									 | 
							
								/* eslint-disable */
							 | 
						||
| 
								 | 
							
								var utils = require('./utils.wxs');
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								function getMonths(minDate, maxDate) {
							 | 
						||
| 
								 | 
							
								  var months = [];
							 | 
						||
| 
								 | 
							
								  var cursor = getDate(minDate);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  cursor.setDate(1);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  do {
							 | 
						||
| 
								 | 
							
								    months.push(cursor.getTime());
							 | 
						||
| 
								 | 
							
								    cursor.setMonth(cursor.getMonth() + 1);
							 | 
						||
| 
								 | 
							
								  } while (utils.compareMonth(cursor, getDate(maxDate)) !== 1);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  return months;
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								function getButtonDisabled(type, currentDate, minRange) {
							 | 
						||
| 
								 | 
							
								  if (currentDate == null) {
							 | 
						||
| 
								 | 
							
								    return true;
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  if (type === 'range') {
							 | 
						||
| 
								 | 
							
								    return !currentDate[0] || !currentDate[1];
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  if (type === 'multiple') {
							 | 
						||
| 
								 | 
							
								    return currentDate.length < minRange;
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  return !currentDate;
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								module.exports = {
							 | 
						||
| 
								 | 
							
								  getMonths: getMonths,
							 | 
						||
| 
								 | 
							
								  getButtonDisabled: getButtonDisabled
							 | 
						||
| 
								 | 
							
								};
							 |