From e7ea25594244a935df7846a949e4d3d9398a669f Mon Sep 17 00:00:00 2001 From: spla Date: Fri, 19 Aug 2022 14:30:39 +0200 Subject: [PATCH] Get current monh or year by default --- budget.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/budget.py b/budget.py index a2975c5..a4bf733 100644 --- a/budget.py +++ b/budget.py @@ -175,6 +175,8 @@ class BillShow: show_option = '' + now = datetime.now(tz) + try: show_option = int(input('\nEnter your choice: ')) @@ -186,13 +188,13 @@ class BillShow: if show_option == 1: self.option = 1 - self.criteria = input('Month (current year)? ') + self.criteria = input('Month (enter = current month)? ') or str(now.month) break elif show_option == 2: self.option = 2 - self.criteria = input('Year ? ') + self.criteria = input('Year (enter = current year)? ') or str(now.year) break elif show_option == 3: @@ -291,6 +293,8 @@ class DonationShow: show_option = '' + now = datetime.now(tz) + try: show_option = int(input('\nEnter your choice: ')) @@ -302,13 +306,13 @@ class DonationShow: if show_option == 1: self.option = 1 - self.criteria = input('Month (current year)? ') + self.criteria = input('Month (enter = current month)? ') or str(now.month) break elif show_option == 2: self.option = 2 - self.criteria = input('Year ? ') + self.criteria = input('Year (enter = current year)? ') or str(now.year) break elif show_option == 3: