From 01739552b828669de053fb2f8ae924c18aeba4b9 Mon Sep 17 00:00:00 2001 From: Sebastian Reichel Date: Thu, 3 Jan 2013 02:04:39 +0100 Subject: fix december invoice --- invoice/generate-invoice.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'invoice') diff --git a/invoice/generate-invoice.py b/invoice/generate-invoice.py index 452d23f..cccebff 100755 --- a/invoice/generate-invoice.py +++ b/invoice/generate-invoice.py @@ -307,8 +307,15 @@ def monthly(timestamp = time.time()): # timestamps for previous month dstop = requested.replace(hour = 8, minute = 0, second = 0, day = 16) - datetime.timedelta(seconds = 1) if dstop > requested: - dstop = dstop.replace(month = dstop.month -1) - dstart = dstop.replace(month = dstop.month -1) + if dstop.month > 1: + dstop = dstop.replace(month = dstop.month -1) + else: + dstop = dstop.replace(month = 12) + if dstop.month > 1: + dstart = dstop.replace(month = dstop.month -1) + else: + dstart = dstop.replace(month = 12) + stop = int(dstop.strftime("%s")) start = int(dstart.strftime("%s")) -- cgit v1.2.3