issue: possible feature list in error
Closed this issue ยท 3 comments
D.today() + 0 # this cause error
TypeError: unsupported operand type(s) for +: 'BeautifulDate' and 'int'
This can just return the same value, which makes it more dynamic
because I was using a variable in adding date D.today() + inputFromUser*days
which can be zero
although I can check It before, but it will be better if beautiful-date do this ๐๐๐
Even if inputFromUser
is 0
, inputFromUser * days
will not be 0
, it will be a zero-timedelta. So D.today() + inputFromUser*days
will work as expected:
>>> D.today() + 0*days
BeautifulDate(2021, 8, 29)
And D.today() + 0
should cause an error because it does not make sense adding integer to a date.
Even if
inputFromUser
is0
,inputFromUser * days
will not be0
, it will be a zero-timedelta. SoD.today() + inputFromUser*days
will work as expected:>>> D.today() + 0*days BeautifulDate(2021, 8, 29)
And
D.today() + 0
should cause an error because it does not make sense adding integer to a date.
ok Thank you, that was a nice description ๐
Just speculating, but check if you don't overwrite days
with some integer. That could cause inputFromUser * days
to end up being 0