Created
April 4, 2013 17:49
-
-
Save mechanicalgirl/5312503 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _month_bounds(date): | |
""" | |
Helper: return the first and last days of the month for the given date. | |
""" | |
first_day = date.replace(day=1) | |
if first_day.month == 12: | |
last_day = first_day.replace(year=first_day.year + 1, month=1) | |
else: | |
last_day = first_day.replace(month=first_day.month + 1) | |
return first_day, last_day |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment