From 772cea40183db63315ace48ea793e3fa5dafec84 Mon Sep 17 00:00:00 2001
From: Hong-Phuc Bui <hong-phuc.bui@htwsaar.de>
Date: Mon, 13 May 2024 02:58:34 +0200
Subject: [PATCH] demo Bug
---
funktion-modular/calendar/month_of_year.py | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/funktion-modular/calendar/month_of_year.py b/funktion-modular/calendar/month_of_year.py
index 29bac62..03c7110 100755
--- a/funktion-modular/calendar/month_of_year.py
+++ b/funktion-modular/calendar/month_of_year.py
@@ -31,12 +31,13 @@
y0 = year - ((14 - month) // 12)
x = y0 + (y0 // 4) - (y0 // 100) + (y0 // 400)
m0 = month + 12 * ((14 - month) // 12) - 2
- return (day + x +(31 * m0) // 12) % 7
+ return (day + x + (31 * m0) // 12) % 7
def count_days_in_month(month: int, year: int) -> int:
count_days = months[month][1]
- if month == 2 and is_leap_year(year): count_days += 1
+ if month == 2 and is_leap_year(year):
+ count_days += 1
return count_days
@@ -76,7 +77,8 @@
days_in_month = count_days_in_month(month, year)
while day <= days_in_month:
month_view += format_day(day, column_width)
- if (day + diff) % 7 == 0: month_view += "\n"
+ if (day + diff) % 7 == 0 and (day < days_in_month):
+ month_view += "\n"
day += 1
return month_view
@@ -88,7 +90,7 @@
weekdays_line = build_weekdays_line(column_width)
calendar_view += f"{weekdays_line}\n"
month_view = build_month_view(month, year, column_width)
- calendar_view += f"{month_view}\n"
+ calendar_view += f"{month_view}"
return calendar_view
--
Gitblit v1.10.0