[squeak-dev] Date and Time parsing from String

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Date and Time parsing from String

Tim Felgentreff
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

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Date and Time parsing from String

laza
I think this is a good addition and tried to copy the versions to the trunk. Now source.squeak.org seems to be dead. :-]

Alex

On Tue, Sep 1, 2009 at 11:44 AM, Tim Felgentreff <[hidden email]> wrote:
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




Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Date and Time parsing from String

Nicolas Cellier
I think mantis has several open/pending entries...

http://bugs.squeak.org/view.php?id=7235
http://bugs.squeak.org/view.php?id=6764
etc... (I just lost mantis connection)

Nicolas

2009/9/1 Alexander Lazarević <[hidden email]>:

> I think this is a good addition and tried to copy the versions to the trunk.
> Now source.squeak.org seems to be dead. :-]
>
> Alex
>
> On Tue, Sep 1, 2009 at 11:44 AM, Tim Felgentreff <[hidden email]> wrote:
>>
>> 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
>>
>
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: Date and Time parsing from String

Andreas.Raab
In reply to this post by laza
Alexander Lazarević wrote:
> I think this is a good addition and tried to copy the versions to the
> trunk. Now source.squeak.org <http://source.squeak.org> seems to be
> dead. :-]

Squeaksource does this occasionally. The code isn't very robust in the
face of heavy usage and we are starting to see the effects. The only
thing that I've seen work is to lean back and wait some 10-20 minutes.
Usually it recovers.

Cheers,
   - Andreas