wilsonfreitas / python-bizdays

Business days calculations and utilities
http://wilsonfreitas.github.io/python-bizdays/
MIT License
80 stars 34 forks source link

Fail to get bizday #24

Closed bergpb closed 6 years ago

bergpb commented 7 years ago

My code:

from bizdays import Calendar holidays = ['2017-01-01','2017-04-2017','2017-05-2017','2017-09-07','2017-10-12','2017-11-11','2017-11-15','2017-12-25'] cal = Calendar(holidays=holidays, weekdays=['Sunday', 'Saturday']) cal.isbizday('2017-11-01')

The output: Traceback (most recent call last): File "dias_uteis.py", line 10, in cal = Calendar(holidays=holidays, weekdays=['Sunday', 'Saturday']) File "/usr/local/lib/python2.7/dist-packages/bizdays.py", line 285, in init self._holidays = [Date(d) for d in holidays] File "/usr/local/lib/python2.7/dist-packages/bizdays.py", line 245, in init d = datetime.strptime(d, format).date() File "/usr/lib/python2.7/_strptime.py", line 328, in _strptime data_string[found.end():]) ValueError: unconverted data remains: 17 *Test on cloud9 ide.

bonix-git commented 6 years ago

Hi bergpb,

Your code has two errors: 2017-04-2017 and 2017-05-2017

Try something like this:

holidays = ['2017-01-01','2017-04-17','2017-05-17','2017-09-07','2017-10-12','2017-11-11','2017-11-15','2017-12-25']

What do you think?

bergpb commented 6 years ago

awesome works like a charm. thanks for your help.