[Seaside] WADateSelector - invalid date handling
Dmitry Dorofeev
dima-sender-3c337a at yasp.com
Tue Feb 22 21:31:21 CET 2005
On 22 Feb 2005, at 22:30, C. David Shaffer wrote:
> Dmitry Dorofeev wrote:
> [snip]
>
>>
>> But when I select 31 feb, i see message
>> You chose 1915-03-03.
>> For 30 feb i got
>> You chose 1915-03-02.
>
> Hmm, with Seaside 2.5b7 and Squeak 3.7full image I get 3/3/2005 which
> definitely isn't the correct behavior either altough it makes a little
> more sense than what you're seeing. What version of Squeak are you
> running?
Sorry, forget to say that i changed code and use yyyymmdd to format
date.
I run Squeak 3.7
> My tutorial was written under 3.6...obviously something has changed
> with date handling so that invalid dates are no longer an error in the
> Date class. Frustrating. I can offer a patch to preserve the
> behavior of isValid. I could also patch the WADateSelector>>date
> method to validate the date. This would preserve the existing
> behavior in WADateSelector. Avi, any thoughts on this? "don't care"
> counts, I guess :-) Hell, I've just attached the patch, reasonbly
> close to preserving the previous behavior of #date and #isValid.
Thanks, will try to find out how to apply it
Or probably even wait what Avi will respond :-)
>
> David
>
> --
> C. David Shaffer
> http://www.cs.westminster.edu/~shaffer
> http://www.shaffer-consulting.com
>
> 'From Squeak3.7 of ''4 September 2004'' [latest update: #5989] on 22
> February 2005 at 2:28:09 pm'!
>
> !WADateSelector methodsFor: 'as yet unclassified' stamp: 'cds
> 2/22/2005 14:22'!
> date
> (self privateIsValidDay: day monthNumber: month year: year)
> ifFalse: [self error: 'Invalid date'].
> ^ Date newDay: day monthNumber: month year: year! !
>
> !WADateSelector methodsFor: 'as yet unclassified' stamp: 'cds
> 2/22/2005 14:27'!
> privateIsValidDay: theDay monthNumber: theMonth year: theYear
> | maxDay |
> theMonth >= 0 & (theMonth < 12) ifFalse: [^false].
> maxDay := Month daysInMonth: theMonth forYear: theYear.
> ^theDay > 0 & (theDay <= maxDay)! !
>
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/listinfo/seaside
More information about the Seaside
mailing list