Hi
I just trying to use WADateSelector as described here: http://www.cdshaffer.com/david/Seaside/DateComponents/ (Thanks Dave!)
But when I select 31 feb, i see message You chose 1915-03-03. For 30 feb i got You chose 1915-03-02.
The year is fine though :-)
Any idea what goes wrong and where ? Seaside is 2.5b7
Thanks,
Dmitry Dorofeev
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? 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.
David
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@lists.squeakfoundation.org http://lists.squeakfoundation.org/listinfo/seaside
On Tue, 22 Feb 2005 14:30:05 -0500, C. David Shaffer cdshaffer@acm.org wrote:
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? 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.
Yep, that looks reasonable - I'll commit a version that includes it as soon as SqueakSource comes back to life.
Lots of stuff with Date broke in 3.7 - very frustrating, I agree. The Chronology changes were, IMO, rushed in way too quickly. There's lots of interesting cool stuff, and ANSI support is nice, but I hate to see the semantics change without warning on such a basic class as Date...
Avi
On Sat, 26 Feb 2005 23:36:38 +0100, Avi Bryant avi.bryant@gmail.com wrote:
Yep, that looks reasonable - I'll commit a version that includes it as soon as SqueakSource comes back to life.
Ok, done.
Avi
seaside@lists.squeakfoundation.org