From ef4e34a7f1d5cdc59d55cf466fde1c9784fe1ed7 Mon Sep 17 00:00:00 2001 From: lara Date: Fri, 17 Apr 2020 14:24:40 -0400 Subject: [PATCH] [work] Fix negative timedelta printing --- bin/work | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/work b/bin/work index c24713c..bae7f33 100755 --- a/bin/work +++ b/bin/work @@ -43,10 +43,14 @@ def signal_handler(signal, frame): def td_format(td): + prefix = "" + if td < timedelta(0): + td = -td + prefix = "-" hours, remainder = divmod(td.total_seconds(), 3600) minutes, seconds = divmod(remainder, 60) - return '{:d}:{:02d}'.format(int(hours), int(minutes)) + return '{}{:d}:{:02d}'.format(prefix, int(hours), int(minutes)) def get_today_fields():