Browse Source

Use "time since" for all references to time.

tags/v0.1^2
Ben Kurtovic 12 years ago
parent
commit
9b3e98d503
1 changed files with 1 additions and 5 deletions
  1. +1
    -5
      earwigbot/tasks/drn_clerkbot.py

+ 1
- 5
earwigbot/tasks/drn_clerkbot.py View File

@@ -706,17 +706,13 @@ class DRNClerkBot(Task):

title = case["case_title"].replace("_", " ").replace("|", "|")
case["title"] = title[:47] + "..." if len(title) > 50 else title
case["file_time"] = self.format_time_since(case["case_file_time"])
case["file_time"] = self.format_time(case["case_file_time"])
case["file_sortkey"] = int(mktime(case["case_file_time"].timetuple()))
case["modify_time"] = self.format_time(case["case_modify_time"])
case["modify_sortkey"] = int(mktime(case["case_modify_time"].timetuple()))
row = "{{" + self.tl_chart_row + data.format(**case) + "}}\n"
return row

def format_time(self, dt):
"""Format a datetime into the standard MediaWiki timestamp format."""
return dt.strftime("%H:%M, %d %b %Y")

def format_time_since(self, dt):
"""Return a string telling the time since datetime occured."""
parts = [("year", 31536000), ("day", 86400), ("hour", 3600)]


Loading…
Cancel
Save