Show age in profile dialog

This commit is contained in:
2019-09-18 13:56:07 -05:00
parent 29e8b00656
commit 33ba50a7b4
2 changed files with 10 additions and 2 deletions

View File

@@ -66,7 +66,13 @@ class userProfilePresenter(base.basePresenter):
self.send_message("set", tab="main_info", control="bdate", value=d.format(_("MMMM D"), locale=languageHandler.curLang[:2]))
else: # mm.dd.yyyy
d = arrow.get(person["bdate"], "D.M.YYYY")
self.send_message("set", tab="main_info", control="bdate", value=d.format(_("MMMM D, YYYY"), locale=languageHandler.curLang[:2]))
# Calculate user's years.
now = arrow.get()
timedelta = now-d
years = int(timedelta.days/365)
date = d.format(_("MMMM D, YYYY"), locale=languageHandler.curLang[:2])
msg = _("{date} ({age} years)").format(date=date, age=years)
self.send_message("set", tab="main_info", control="bdate", value=msg)
# Format current city and home town
city = ""
if "home_town" in person and person["home_town"] != "":