Day number

main2
Bob Mottram 2019-10-10 20:00:57 +01:00
parent 4aa832fc02
commit e6118ef5f3
1 changed files with 2 additions and 2 deletions

View File

@ -2749,7 +2749,6 @@ def weekDayOfMonthStart(monthNumber: int,year: int) -> int:
1=sun, 7=sat
"""
firstDayOfMonth=datetime(year, monthNumber, 1, 0, 0)
print('weekDayOfMonthStart: '+str(int(firstDayOfMonth.strftime("%w"))+1))
return int(firstDayOfMonth.strftime("%w"))+1
def htmlCalendar(translate: {}, \
@ -2822,11 +2821,12 @@ def htmlCalendar(translate: {}, \
calendarStr+='<tbody>\n'
dayOfMonth=0
dow=weekDayOfMonthStart(monthNumber,year)
for weekOfMonth in range(1,5):
calendarStr+=' <tr>\n'
for dayNumber in range(1,7):
if (weekOfMonth>1 and dayOfMonth<=daysInMonth) or \
(weekOfMonth==1 and dayOfMonth>=weekDayOfMonthStart(monthNumber,year)):
(weekOfMonth==1 and dayNumber>=dow):
dayOfMonth+=1
calendarStr+=' <td class="calendar__day__cell">'+str(dayOfMonth)+'</td>\n'
else: