Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed date_to_day_of_year calc issue #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ def date_to_day_of_year(year, month, day):
"""Return the day of year for the specified date in the range 1 - 366.
"""
# If month is January, just return the day.
if month == 1:
if month == 0:
return day
# Accumulate days from all months prior to the specified month.
num_days = 0
for i in range(1, month):
for i in range(0, month):
num_days += ABBREV_MONTH_NUM_DAYS_PAIRS[i - 1][1]
# Maybe add a leap day.
if month > 2 and is_leap_year(year):
Expand Down