Time Problems with Squeak 2.8 alpha for Windows

Bob Arning arning at charm.net
Tue Aug 1 17:16:17 UTC 2000


On Tue, 1 Aug 2000 12:53:25 -0400 "Jochen F. Rick" <nadja at cc.gatech.edu> wrote:
>| date |
>date _ Date today.
>(date = (Date halt fromString: (date dayOfMonth asString, '/', date monthIndex
>asString, '/', date year asString))) inspect.
>
>I had someone report that this caused problems with Squeak2.8 alpha on 
>Windows. Why is that? Did fromString: get changed? If so, what is the 
>recommended way to deal with a string of the form dd/mm/yyyy?

Je77,

This happened in change set 2327DateTimeRefac-bp which substituted a julian date implementation strategy. The comments of the relevant methods are a bit at odds:

fromString: aString
	"Answer an instance of created from a string with format DD.MM.YYYY."

	^self readFrom: (ReadStream on: aString).

readFrom: aStream
	"Read a Date from the stream in any of the forms:
		<day> <monthName> <year>		(5 April 1982; 5-APR-82)
		<monthName> <day> <year>		(April 5, 1982)
		<monthNumber> <day> <year>	(4/5/82)"

Since getting agreement on the _right_ way to write dates could take forever, one could use a variant of the previous version of the method:

fromStringDayFirst: aString
	"Answer an instance of created from a string with format DD.MM.YYYY."

	| fields |
	fields := aString findTokens: './'.
	^self newDay: (fields at: 1) asNumber month: (fields at: 2) asNumber year: (fields at: 3) asNumber

At least then we know what the sender expects.

Cheers,
Bob





More information about the Squeak-dev mailing list