[squeak-dev] Date and Time parsing from String

Tim Felgentreff tim at nada1.de
Tue Sep 1 09:44:59 UTC 2009


Hello

Some time ago when I was parsing a lot of date+time strings from the  
web I came across quite a few who did not quite adhere to standards,  
so they would sometimes not get parsed properly.
Currently the logic in parsing dates in "Date>>readFrom:" and times in  
"Time>>readFrom:" isnot used in "DateAndTime>>readFrom:", so I thought  
why not have the code in one place only and make it a bit more  
forgiving.
So I added nanoSecond parsing to the Time>>readFrom: and ISO8601- 
format parsing to Date>>readFrom:. Now DateAndTime>>readFrom: just  
uses those two methods and only parses the optional offset at the end.
The tests run through and I also added one test and changed another to  
test the "new" format allowed for Date and Time respectively.
I'm not sure if something as this should be changed just like that,  
but I thought offering it can't hurt.

--
Regards, Tim



More information about the Squeak-dev mailing list