Add time.first_of_year()
convenience function
This commit is contained in:
parent
4323fde854
commit
1719351495
|
@ -183,6 +183,13 @@ def last_of_month(date):
|
|||
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):
|
||||
"""
|
||||
Generator which yields all dates between ``start`` and ``end``, *inclusive*.
|
||||
|
|
Loading…
Reference in a new issue