[issue41904] datetime.datetime.today makes no sense and should be removed

Damian Yurzola report at bugs.python.org
Wed Oct 14 11:17:51 EDT 2020


Damian Yurzola <damian at yurzola.net> added the comment:

Sorry I got my "current" wrong and I can't find the edit button
Here again:


> "How long is it until Christmas?"

# Current implementation
In [23]: datetime.datetime(2020, 12, 25) - datetime.datetime.today()
Out[23]: datetime.timedelta(days=71, seconds=53018, microseconds=941806)

# Hassan's
In [16]: datetime.datetime(2020, 12, 25) - datetime.datetime(datetime.datetime.today().year, datetime.datetime.today().month, datetime.datetime.today().day)
Out[16]: datetime.timedelta(days=72)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41904>
_______________________________________


More information about the Python-bugs-list mailing list