[Seaside] WAMiniCalendar bug (and fix)

Frank Shearar frank.shearar at angband.za.org
Tue Mar 30 14:41:21 UTC 2010


Hi everyone,

I played around a bit with WAMiniCalendar today, and found something 
funny. I went back to March 2008, and I can see an extra row. The first 
row of the table is completely blank - 
<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr> 
- and then the rest of the month is displayed normally.

That's happening because March 2008 starts on a Sunday.

WAMiniCalendar>>weeksDo: needs to look like this:

weeksDo: aBlock
	| day nextMonth |
	day := Date newDay: 1 monthNumber: self monthIndex year: self year.

	(day dayOfWeek < 7) ifTrue: [day := day subtractDays: day dayOfWeek].
	nextMonth := (self monthIndex \\ 12) + 1.
	[ day monthIndex = nextMonth ] whileFalse: [
		aBlock value: day.
		day := day addDays: 7 ]

(Summary: day := day subtractDays: day dayOfWeek gets a conditional.)

frank


More information about the seaside mailing list