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.
		
		
		
		
		
			
		
			
				
					15 lines
				
				646 B
			
		
		
			
		
	
	
					15 lines
				
				646 B
			| 
								 
											3 years ago
										 
									 | 
							
								import toDate from '../../toDate/index.js';
							 | 
						||
| 
								 | 
							
								import requiredArgs from '../requiredArgs/index.js';
							 | 
						||
| 
								 | 
							
								var MILLISECONDS_IN_DAY = 86400000; // 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 getUTCDayOfYear(dirtyDate) {
							 | 
						||
| 
								 | 
							
								  requiredArgs(1, arguments);
							 | 
						||
| 
								 | 
							
								  var date = toDate(dirtyDate);
							 | 
						||
| 
								 | 
							
								  var timestamp = date.getTime();
							 | 
						||
| 
								 | 
							
								  date.setUTCMonth(0, 1);
							 | 
						||
| 
								 | 
							
								  date.setUTCHours(0, 0, 0, 0);
							 | 
						||
| 
								 | 
							
								  var startOfYearTimestamp = date.getTime();
							 | 
						||
| 
								 | 
							
								  var difference = timestamp - startOfYearTimestamp;
							 | 
						||
| 
								 | 
							
								  return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
							 | 
						||
| 
								 | 
							
								}
							 |