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.
		
		
		
		
		
			
		
			
				
					
					
						
							20 lines
						
					
					
						
							1.1 KiB
						
					
					
				
			
		
		
	
	
							20 lines
						
					
					
						
							1.1 KiB
						
					
					
				| import toInteger from '../toInteger/index.js';
 | |
| import getUTCWeekYear from '../getUTCWeekYear/index.js';
 | |
| import startOfUTCWeek from '../startOfUTCWeek/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 startOfUTCWeekYear(dirtyDate, dirtyOptions) {
 | |
|   requiredArgs(1, arguments);
 | |
|   var options = dirtyOptions || {};
 | |
|   var locale = options.locale;
 | |
|   var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;
 | |
|   var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
 | |
|   var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate);
 | |
|   var year = getUTCWeekYear(dirtyDate, dirtyOptions);
 | |
|   var firstWeek = new Date(0);
 | |
|   firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
 | |
|   firstWeek.setUTCHours(0, 0, 0, 0);
 | |
|   var date = startOfUTCWeek(firstWeek, dirtyOptions);
 | |
|   return date;
 | |
| } |