dgorissen / pycel

A library for compiling excel spreadsheets to python code & visualizing them as a graph
GNU General Public License v3.0
573 stars 152 forks source link

In normalize_year(), month % 12 can be 0 -> IllegalMonthError #54

Closed Dagg-h closed 5 years ago

Dagg-h commented 5 years ago

https://github.com/dgorissen/pycel/blob/2c4d19826ccd84cb879c908831ee1ef948bb35a4/src/pycel/excelutil.py#L990

Traceback (most recent call last): File "\PyCel\venv\lib\site-packages\pycel\excellib.py", line 190, in date year, month, day = normalize_year(year, month, day) File "\PyCel\venv\lib\site-packages\pycel\excelutil.py", line 913, in normalize_year days_in_month = get_max_days_in_month(m, y) File "\PyCel\venv\lib\site-packages\pycel\excelutil.py", line 892, in get_max_days_in_month return calendar.monthrange(year, month)[1] File "\bin\python3.7\lib\calendar.py", line 124, in monthrange raise IllegalMonthError(month) calendar.IllegalMonthError: bad month number 0; must be 1-12

stephenrauch commented 5 years ago

Thanks so much for reporting this. I am able to duplicate it, and should have a fix released soon.