diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2014-03-21 14:24:20 +0000 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2014-03-21 14:24:20 +0000 |
commit | 0801f9c99c773190368fddbaa2c29dbe0142cd2c (patch) | |
tree | c3be841578252d60c26baf5a2a011b9952a358bf | |
parent | 622c85370d7c2b4d940e25e58ac468373c943f02 (diff) | |
download | lorry-controller-0801f9c99c773190368fddbaa2c29dbe0142cd2c.tar.gz |
Format due times as "now" if before current time
-rwxr-xr-x | lorry-controller-webapp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lorry-controller-webapp b/lorry-controller-webapp index 42b14ba..70ee8f7 100755 --- a/lorry-controller-webapp +++ b/lorry-controller-webapp @@ -565,8 +565,9 @@ class StatusRenderer(object): def format_due_nicely(self, due): exact = time.strftime('%Y-%m-%d %H:%M:%S UTC', time.gmtime(due)) - nice = self.format_secs_nicely(due - time.time()) - if due == 0: + now = time.time() + nice = self.format_secs_nicely(now) + if due <= now: return nice else: return '%s (%s)' % (exact, nice) |