Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita9f0916

Browse files
committed
fix(clock): ensure selected day does not exceed days in month
1 parented26165 commita9f0916

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

‎src/core/widgets/yasb/clock.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,13 @@ def update_month_label(self, year, month):
191191
qlocale=QLocale(self._locale)ifself._localeelseQLocale.system()
192192
new_month=qlocale.monthName(month)
193193
self.month_label.setText(new_month)
194-
# Update day and date based on the calendar’s selected day
195-
selectedDate=self.calendar.selectedDate()
196-
newDate=QDate(year,month,selectedDate.day())
194+
195+
selected_day=self.calendar.selectedDate().day()
196+
days_in_month=QDate(year,month,1).daysInMonth()
197+
ifselected_day>days_in_month:
198+
selected_day=days_in_month
199+
200+
newDate=QDate(year,month,selected_day)
197201
self.day_label.setText(qlocale.dayName(newDate.dayOfWeek()))
198202
self.date_label.setText(newDate.toString("d"))
199203

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp