From 44da8561207f99f18841260064720f9cd7fb2d12 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sun, 4 Oct 2015 19:16:13 -0500 Subject: [PATCH] Show year in end time if not this year. --- earwigbot/commands/remind.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/earwigbot/commands/remind.py b/earwigbot/commands/remind.py index 8b32585..f61e3f4 100644 --- a/earwigbot/commands/remind.py +++ b/earwigbot/commands/remind.py @@ -402,7 +402,11 @@ class _Reminder(object): def end_time(self): """Return a string representing the end time of a reminder.""" if self.end >= time.time(): - ends = time.strftime("%b %d %H:%M:%S %Z", time.localtime(self.end)) + lctime = time.localtime(self.end) + if lctime.tm_year == time.localtime().tm_year: + ends = time.strftime("%b %d %H:%M:%S %Z", lctime) + else: + ends = time.strftime("%b %d, %Y %H:%M:%S %Z", lctime) return "ends {0}".format(ends) return "expired"