Skip to content

Commit

Permalink
date formatting edited (-d replaced) (#3732)
Browse files Browse the repository at this point in the history
  • Loading branch information
lindakarlovska committed May 27, 2024
1 parent 9f2952c commit f3ccff6
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions gui/wxpython/history/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,21 @@ def dayToLabel(self, day):
if day == OLD_DATE:
return _("No time info")

month_name = day.strftime("%B")
base_date = _("{month_name} {day_number}").format(
month_name=month_name, day_number=day.day
)

if day == current_date:
return "{:%B %-d} (today)".format(day)
return _("{base_date} (today)").format(base_date=base_date)
elif day == current_date - datetime.timedelta(days=1):
return "{:%B %-d} (yesterday)".format(day)
return _("{base_date} (yesterday)").format(base_date=base_date)
elif day >= (current_date - datetime.timedelta(days=current_date.weekday())):
return "{:%B %-d} (this week)".format(day)
return _("{base_date} (this week)").format(base_date=base_date)
elif day.year == current_date.year:
return "{:%B %-d}".format(day)
return _("{base_date}").format(base_date=base_date)
else:
return "{:%B %-d, %Y}".format(day)
return _("{base_date}, {year}").format(base_date=base_date, year=day.year)


class HistoryBrowserTree(CTreeView):
Expand Down

0 comments on commit f3ccff6

Please sign in to comment.