Add time.first_of_year() convenience function
				
					
				
			This commit is contained in:
		
							parent
							
								
									4323fde854
								
							
						
					
					
						commit
						1719351495
					
				
					 1 changed files with 7 additions and 0 deletions
				
			
		| 
						 | 
					@ -183,6 +183,13 @@ def last_of_month(date):
 | 
				
			||||||
    return date.replace(day=last_day)
 | 
					    return date.replace(day=last_day)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def first_of_year(date):
 | 
				
			||||||
 | 
					    """
 | 
				
			||||||
 | 
					    Returns a date representing the first day of whichever year ``date`` falls in.
 | 
				
			||||||
 | 
					    """
 | 
				
			||||||
 | 
					    return date.replace(month=1, day=1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def date_range(start, end, step=1):
 | 
					def date_range(start, end, step=1):
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    Generator which yields all dates between ``start`` and ``end``, *inclusive*.
 | 
					    Generator which yields all dates between ``start`` and ``end``, *inclusive*.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue