timefhuman
timefhuman copied to clipboard
Index out of range
When running timefhuman('last wednesday of july'), I get the following error:
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from timefhuman import timefhuman
>>> timefhuman('last wednesday of july')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/eric.semeniuc/.ansible/py3/lib/python3.6/site-packages/timefhuman/main.py", line 58, in timefhuman
tokens = timefhuman_tokens(string, now)
File "/home/eric.semeniuc/.ansible/py3/lib/python3.6/site-packages/timefhuman/main.py", line 75, in timefhuman_tokens
tokens = categorize(tokens, now)
File "/home/eric.semeniuc/.ansible/py3/lib/python3.6/site-packages/timefhuman/categorize.py", line 35, in categorize
tokens = maybe_substitute_using_month(tokens, now)
File "/home/eric.semeniuc/.ansible/py3/lib/python3.6/site-packages/timefhuman/categorize.py", line 193, in maybe_substitute_using_month
next_candidate = tokens[index+1]
IndexError: list index out of range
>>>
Platform: Ubuntu 18.04 x64, installed using pip3
Also happens with timefhuman('last wednesday in july')
@esemeniuc Thanks for reporting! The parser is looking for "last
I also got this error when trying to run timefhuman('last day of december') or timefhuman('last week of november')
so +1 for this feature request.
Thanks for reporting -- this will be helpful the next chance I get to work on this.