You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I also didn't expect this behavior, but humanize.naturaldelta() matches the behavior of datetime.timedelta(). Or rather it's caused by the behavior of datetime.timedelta()? The question is whether it's correct to humanize "-1 days and 86k seconds" to "a day (ago)".
One solution could be to call abs() on the value parameter since a delta is neither negative or positive. abs() also works on dt.timedeltas.
hugovk
changed the title
Naturaldelta with negative seconds looses precision and doesn't match naturaltime
naturaldelta with negative seconds loses precision and doesn't match naturaltime
May 19, 2022
What did you do?
I passed a small negative integer value to
naturaldelta
, it reports "a day".What did you expect to happen?
I expect
naturaldelta
to roughly matchnaturaltime
. Else, if negative values are not supported, it should be documented.What actually happened?
shows:
What versions are you using?
Linux LCARS2 5.17.4-200.fc35.x86_64 #1 SMP PREEMPT Wed Apr 20 15:37:53 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: