Mercurial > kallithea
changeset 8168:7d5dfe117d0f
summary: use calendar.monthrange instead of internal calendar.mday
Fix pytype warning:
No attribute 'mdays' on module 'calendar' [module-attr]
This also takes care of handling leap-years correctly. Not that it matters, but
very nice ...
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Tue, 04 Feb 2020 02:58:53 +0100 |
parents | 8114623895cc |
children | e68c0cd1647d |
files | kallithea/controllers/summary.py |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/controllers/summary.py Wed Feb 05 13:22:53 2020 +0100 +++ b/kallithea/controllers/summary.py Tue Feb 04 02:58:53 2020 +0100 @@ -172,7 +172,7 @@ c.no_data_msg = _('Statistics are disabled for this repository') td = date.today() + timedelta(days=1) - td_1m = td - timedelta(days=calendar.mdays[td.month]) + td_1m = td - timedelta(days=calendar.monthrange(td.year, td.month)[1]) td_1y = td - timedelta(days=365) ts_min_m = mktime(td_1m.timetuple())