From 1881e4b9ed5e1ad1f5bd084881a83f46c26004d3 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 5 Dec 2017 00:00:25 +1000 Subject: [PATCH] Correct date return month_start, month_end (#107) Changes solve the problem of the incorrect date to "def current_month()". The error occured due to incorrect date format month_start. --- longclaw/longclawstats/stats.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/longclaw/longclawstats/stats.py b/longclaw/longclawstats/stats.py index 9b8af88..94dd5d4 100644 --- a/longclaw/longclawstats/stats.py +++ b/longclaw/longclawstats/stats.py @@ -11,8 +11,8 @@ from longclaw.longclaworders.models import Order, OrderItem def current_month(): now = datetime.now() n_days = calendar.monthrange(now.year, now.month)[1] - month_start = datetime.strptime('1{}{}'.format(now.month, now.year), '%d%m%Y') - month_end = datetime.strptime('{}{}{}'.format(n_days, now.month, now.year), '%d%m%Y') + month_start = datetime.strptime('{}{}{}'.format(now.year, now.month, 1), '%Y%m%d') + month_end = datetime.strptime('{}{}{}'.format(now.year,now.month, n_days), '%Y%m%d') return month_start, month_end