[Seaside] [Bug][Fix] WADateSelector
koschate at gmail.com
Thu Jul 7 23:17:21 CEST 2005
Raymond Asselin wrote:
>privateIsValidDay: theDay monthNumber: theMonth year: theYear
> | maxDay |
> theMonth >= 0 & (theMonth < 13) ifFalse: [^false].
> maxDay := Month daysInMonth: theMonth forYear: theYear.
> ^theDay > 0 & (theDay <= maxDay)
How about an approach taking advantage of Smalltalk idiom?
privateIsValidDay: theDay monthNumber: theMonth year: theYear
^(theMonth between: 1 and: 12)
and: [theDay between: 1 and: (Month daysInMonth: theMonth
Note: I hate creating temporary variables unnecessarily!
The implementation of #between:and: in both Squeak and VisualWorks is this:
between: min and: max
^self >= min and: [self <= max]
More information about the Seaside