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.
		
		
		
		
		
			
		
			
				
					14 lines
				
				624 B
			
		
		
			
		
	
	
					14 lines
				
				624 B
			| 
								 
											3 years ago
										 
									 | 
							
								import toInteger from '../toInteger/index.js';
							 | 
						||
| 
								 | 
							
								import toDate from '../../toDate/index.js';
							 | 
						||
| 
								 | 
							
								import getUTCISOWeek from '../getUTCISOWeek/index.js';
							 | 
						||
| 
								 | 
							
								import requiredArgs from '../requiredArgs/index.js'; // This function will be a part of public API when UTC function will be implemented.
							 | 
						||
| 
								 | 
							
								// See issue: https://github.com/date-fns/date-fns/issues/376
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								export default function setUTCISOWeek(dirtyDate, dirtyISOWeek) {
							 | 
						||
| 
								 | 
							
								  requiredArgs(2, arguments);
							 | 
						||
| 
								 | 
							
								  var date = toDate(dirtyDate);
							 | 
						||
| 
								 | 
							
								  var isoWeek = toInteger(dirtyISOWeek);
							 | 
						||
| 
								 | 
							
								  var diff = getUTCISOWeek(date) - isoWeek;
							 | 
						||
| 
								 | 
							
								  date.setUTCDate(date.getUTCDate() - diff * 7);
							 | 
						||
| 
								 | 
							
								  return date;
							 | 
						||
| 
								 | 
							
								}
							 |