Bug in Date>>readFrom:pattern: ? Pharo2.0

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

Bug in Date>>readFrom:pattern: ? Pharo2.0

Sabine Manaa
Hi,

Date readFrom: '4.2.13' readStream pattern: 'd.m.yy'

Does not return 4.2.2013 but 4.2.0013

The comment is saying
"A year given using only two decimals is considered to be >2000"

So, the comment is not ok or this is a bug?

Sabine
Reply | Threaded
Open this post in threaded view
|

Re: Bug in Date>>readFrom:pattern: ? Pharo2.0

Stéphane Ducasse
Hello Sabine
probably a bug.
If you can write some tests and publish them on the bugtracker this will help.
If you provide the fix (it will be faster to get it fixed) please run the tests to make sure that we do not
introduce side effects.

Stef

> Hi,
>
> Date readFrom: '4.2.13' readStream pattern: 'd.m.yy'
>
> Does not return 4.2.2013 but 4.2.0013
>
> The comment is saying
> "A year given using only two decimals is considered to be >2000"
>
> So, the comment is not ok or this is a bug?
>
> Sabine
>
>
>
> --
> View this message in context: http://forum.world.st/Bug-in-Date-readFrom-pattern-Pharo2-0-tp4700427.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>


Reply | Threaded
Open this post in threaded view
|

Re: Bug in Date>>readFrom:pattern: ? Pharo2.0

Sabine Manaa
Hi,

I created a bug, hoping that I filled out every field correctly.

https://pharo.fogbugz.com/f/cases/11222/Date-readFrom-pattern-year-2-decimals-not-20xx-but-00xx

Sabine

On Wed, Jul 24, 2013 at 9:52 AM, Stéphane Ducasse [via Smalltalk]
<[hidden email]> wrote:

> Hello Sabine
> probably a bug.
> If you can write some tests and publish them on the bugtracker this will
> help.
> If you provide the fix (it will be faster to get it fixed) please run the
> tests to make sure that we do not
> introduce side effects.
>
> Stef
>
>> Hi,
>>
>> Date readFrom: '4.2.13' readStream pattern: 'd.m.yy'
>>
>> Does not return 4.2.2013 but 4.2.0013
>>
>> The comment is saying
>> "A year given using only two decimals is considered to be >2000"
>>
>> So, the comment is not ok or this is a bug?
>>
>> Sabine
>>
>>
>>
>> --
>> View this message in context:
>> http://forum.world.st/Bug-in-Date-readFrom-pattern-Pharo2-0-tp4700427.html
>> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>>
>
>
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://forum.world.st/Bug-in-Date-readFrom-pattern-Pharo2-0-tp4700427p4700428.html
> To unsubscribe from Bug in Date>>readFrom:pattern: ? Pharo2.0, click here.
> NAML
Reply | Threaded
Open this post in threaded view
|

Re: Bug in Date>>readFrom:pattern: ? Pharo2.0

Mariano Martinez Peck
I also hate #yyyymmdd

Date today yyyymmdd -> '2013-07-24'

I would expect '20130724'

Cheers,


On Wed, Jul 24, 2013 at 5:59 AM, Sabine Knöfel <[hidden email]> wrote:
Hi,

I created a bug, hoping that I filled out every field correctly.

https://pharo.fogbugz.com/f/cases/11222/Date-readFrom-pattern-year-2-decimals-not-20xx-but-00xx

Sabine

On Wed, Jul 24, 2013 at 9:52 AM, Stéphane Ducasse [via Smalltalk]
<[hidden email]> wrote:

> Hello Sabine
> probably a bug.
> If you can write some tests and publish them on the bugtracker this will
> help.
> If you provide the fix (it will be faster to get it fixed) please run the
> tests to make sure that we do not
> introduce side effects.
>
> Stef
>
>> Hi,
>>
>> Date readFrom: '4.2.13' readStream pattern: 'd.m.yy'
>>
>> Does not return 4.2.2013 but 4.2.0013
>>
>> The comment is saying
>> "A year given using only two decimals is considered to be >2000"
>>
>> So, the comment is not ok or this is a bug?
>>
>> Sabine
>>
>>
>>
>> --
>> View this message in context:
>> http://forum.world.st/Bug-in-Date-readFrom-pattern-Pharo2-0-tp4700427.html
>> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>>
>
>
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://forum.world.st/Bug-in-Date-readFrom-pattern-Pharo2-0-tp4700427p4700428.html
> To unsubscribe from Bug in Date>>readFrom:pattern: ? Pharo2.0, click here.
> NAML


View this message in context: Re: Bug in Date>>readFrom:pattern: ? Pharo2.0

Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



--
Mariano
http://marianopeck.wordpress.com
Reply | Threaded
Open this post in threaded view
|

Re: Bug in Date>>readFrom:pattern: ? Pharo2.0

Sabine Manaa
I agree

The comment of yyyymmdd is saying
        "Format the date in ISO 8601 standard like '2002-10-22'
        The result is of fixed size 10 characters long.."

so I would say the selector is not choosen very careful.

There is a discussion in Fogbuz about >>readFrom:pattern:
https://pharo.fogbugz.com/default.asp?11222

Sabine

On Wed, Jul 24, 2013 at 2:56 PM, Mariano Martinez Peck [via Smalltalk]
<[hidden email]> wrote:

> I also hate #yyyymmdd
>
> Date today yyyymmdd -> '2013-07-24'
>
> I would expect '20130724'
>
> Cheers,
>
>
> On Wed, Jul 24, 2013 at 5:59 AM, Sabine Knöfel <[hidden email]> wrote:
>>
>> Hi,
>>
>> I created a bug, hoping that I filled out every field correctly.
>>
>>
>> https://pharo.fogbugz.com/f/cases/11222/Date-readFrom-pattern-year-2-decimals-not-20xx-but-00xx
>>
>> Sabine
>>
>> On Wed, Jul 24, 2013 at 9:52 AM, Stéphane Ducasse [via Smalltalk]
>> <[hidden email]> wrote:
>>
>> > Hello Sabine
>> > probably a bug.
>> > If you can write some tests and publish them on the bugtracker this will
>> > help.
>> > If you provide the fix (it will be faster to get it fixed) please run
>> > the
>> > tests to make sure that we do not
>> > introduce side effects.
>> >
>> > Stef
>> >
>> >> Hi,
>> >>
>> >> Date readFrom: '4.2.13' readStream pattern: 'd.m.yy'
>> >>
>> >> Does not return 4.2.2013 but 4.2.0013
>> >>
>> >> The comment is saying
>> >> "A year given using only two decimals is considered to be >2000"
>> >>
>> >> So, the comment is not ok or this is a bug?
>> >>
>> >> Sabine
>> >>
>> >>
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> >> http://forum.world.st/Bug-in-Date-readFrom-pattern-Pharo2-0-tp4700427.html
>> >> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>> >>
>> >
>> >
>> >
>> >
>> > ________________________________
>> > If you reply to this email, your message will be added to the discussion
>> > below:
>> >
>> > http://forum.world.st/Bug-in-Date-readFrom-pattern-Pharo2-0-tp4700427p4700428.html
>> > To unsubscribe from Bug in Date>>readFrom:pattern: ? Pharo2.0, click
>> > here.
>> > NAML
>>
>> ________________________________
>> View this message in context: Re: Bug in Date>>readFrom:pattern: ?
>> Pharo2.0
>>
>> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://forum.world.st/Bug-in-Date-readFrom-pattern-Pharo2-0-tp4700427p4700533.html
> To unsubscribe from Bug in Date>>readFrom:pattern: ? Pharo2.0, click here.
> NAML
Reply | Threaded
Open this post in threaded view
|

Re: Bug in Date>>readFrom:pattern: ? Pharo2.0

Stéphane Ducasse
I remember that once camillo suggested to use the same approach as in dart where you can specify a strategy.


I agree

The comment of yyyymmdd is saying
        "Format the date in ISO 8601 standard like '2002-10-22'
        The result is of fixed size 10 characters long.."

so I would say the selector is not choosen very careful.

There is a discussion in Fogbuz about >>readFrom:pattern:
https://pharo.fogbugz.com/default.asp?11222

Sabine

On Wed, Jul 24, 2013 at 2:56 PM, Mariano Martinez Peck [via Smalltalk]
<<a href="x-msg://6815/user/SendEmail.jtp?type=node&amp;node=4700542&amp;i=0" target="_top" rel="nofollow" link="external">[hidden email]> wrote:

> I also hate #yyyymmdd
>
> Date today yyyymmdd -> '2013-07-24'
>
> I would expect '20130724'
>
> Cheers,
>
>
> On Wed, Jul 24, 2013 at 5:59 AM, Sabine Knöfel <[hidden email]> wrote:
>>
>> Hi,
>>
>> I created a bug, hoping that I filled out every field correctly.
>>
>>
>> https://pharo.fogbugz.com/f/cases/11222/Date-readFrom-pattern-year-2-decimals-not-20xx-but-00xx
>>
>> Sabine
>>
>> On Wed, Jul 24, 2013 at 9:52 AM, Stéphane Ducasse [via Smalltalk]
>> <[hidden email]> wrote:
>>
>> > Hello Sabine
>> > probably a bug.
>> > If you can write some tests and publish them on the bugtracker this will
>> > help.
>> > If you provide the fix (it will be faster to get it fixed) please run
>> > the
>> > tests to make sure that we do not
>> > introduce side effects.
>> >
>> > Stef
>> >
>> >> Hi,
>> >>
>> >> Date readFrom: '4.2.13' readStream pattern: 'd.m.yy'
>> >>
>> >> Does not return 4.2.2013 but 4.2.0013
>> >>
>> >> The comment is saying
>> >> "A year given using only two decimals is considered to be >2000"
>> >>
>> >> So, the comment is not ok or this is a bug?
>> >>
>> >> Sabine
>> >>
>> >>
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> >> http://forum.world.st/Bug-in-Date-readFrom-pattern-Pharo2-0-tp4700427.html
>> >> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>> >>
>> >
>> >
>> >
>> >
>> > ________________________________
>> > If you reply to this email, your message will be added to the discussion
>> > below:
>> >
>> > http://forum.world.st/Bug-in-Date-readFrom-pattern-Pharo2-0-tp4700427p4700428.html
>> > To unsubscribe from Bug in Date>>readFrom:pattern: ? Pharo2.0, click
>> > here.
>> > NAML
>>
>> ________________________________
>> View this message in context: Re: Bug in Date>>readFrom:pattern: ?
>> Pharo2.0
>>
>> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://forum.world.st/Bug-in-Date-readFrom-pattern-Pharo2-0-tp4700427p4700533.html
> To unsubscribe from Bug in Date>>readFrom:pattern: ? Pharo2.0, click here.
> NAML


View this message in context: Re: Bug in Date>>readFrom:pattern: ? Pharo2.0
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: Bug in Date>>readFrom:pattern: ? Pharo2.0

Sven Van Caekenberghe-2

On 24 Jul 2013, at 18:20, Stéphane Ducasse <[hidden email]> wrote:

> I remember that once camillo suggested to use the same approach as in dart where you can specify a strategy.

The ZTimestamp package contains such an example-based parser/formatter (load from the config browser or from http://www.smalltalkhub.com/#!/~SvenVanCaekenberghe/Neo) that can do what you want and much more, like multi-language weeks/months, for formatting & parsing.

((ZTimestampFormat fromString: '3.2.01')
    createDate;
    parse: '4.2.13')

= (Date newDay: 4 month: 2 year: 2013 )

It is based on how things are done in Go. Read the class docs & tests for more information.

You could subclass ZTimestampFormat and override #parseYearTwoDigitsFrom: to fine-tune the behaviour of 2 digit year specifications.

Sven

>> I agree
>>
>> The comment of yyyymmdd is saying
>>         "Format the date in ISO 8601 standard like '2002-10-22'
>>         The result is of fixed size 10 characters long.."
>>
>> so I would say the selector is not choosen very careful.
>>
>> There is a discussion in Fogbuz about >>readFrom:pattern:
>> https://pharo.fogbugz.com/default.asp?11222
>>
>> Sabine
>>
>> On Wed, Jul 24, 2013 at 2:56 PM, Mariano Martinez Peck [via Smalltalk]
>> <[hidden email]> wrote:
>>
>> > I also hate #yyyymmdd
>> >
>> > Date today yyyymmdd -> '2013-07-24'
>> >
>> > I would expect '20130724'
>> >
>> > Cheers,
>> >
>> >
>> > On Wed, Jul 24, 2013 at 5:59 AM, Sabine Knöfel <[hidden email]> wrote:
>> >>
>> >> Hi,
>> >>
>> >> I created a bug, hoping that I filled out every field correctly.
>> >>
>> >>
>> >> https://pharo.fogbugz.com/f/cases/11222/Date-readFrom-pattern-year-2-decimals-not-20xx-but-00xx
>> >>
>> >> Sabine
>> >>
>> >> On Wed, Jul 24, 2013 at 9:52 AM, Stéphane Ducasse [via Smalltalk]
>> >> <[hidden email]> wrote:
>> >>
>> >> > Hello Sabine
>> >> > probably a bug.
>> >> > If you can write some tests and publish them on the bugtracker this will
>> >> > help.
>> >> > If you provide the fix (it will be faster to get it fixed) please run
>> >> > the
>> >> > tests to make sure that we do not
>> >> > introduce side effects.
>> >> >
>> >> > Stef
>> >> >
>> >> >> Hi,
>> >> >>
>> >> >> Date readFrom: '4.2.13' readStream pattern: 'd.m.yy'
>> >> >>
>> >> >> Does not return 4.2.2013 but 4.2.0013
>> >> >>
>> >> >> The comment is saying
>> >> >> "A year given using only two decimals is considered to be >2000"
>> >> >>
>> >> >> So, the comment is not ok or this is a bug?
>> >> >>
>> >> >> Sabine
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >> >> http://forum.world.st/Bug-in-Date-readFrom-pattern-Pharo2-0-tp4700427.html
>> >> >> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>> >> >>
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > ________________________________
>> >> > If you reply to this email, your message will be added to the discussion
>> >> > below:
>> >> >
>> >> > http://forum.world.st/Bug-in-Date-readFrom-pattern-Pharo2-0-tp4700427p4700428.html
>> >> > To unsubscribe from Bug in Date>>readFrom:pattern: ? Pharo2.0, click
>> >> > here.
>> >> > NAML
>> >>
>> >> ________________________________
>> >> View this message in context: Re: Bug in Date>>readFrom:pattern: ?
>> >> Pharo2.0
>> >>
>> >> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>> >
>> >
>> >
>> >
>> > --
>> > Mariano
>> > http://marianopeck.wordpress.com
>> >
>> >
>> > ________________________________
>> > If you reply to this email, your message will be added to the discussion
>> > below:
>> > http://forum.world.st/Bug-in-Date-readFrom-pattern-Pharo2-0-tp4700427p4700533.html
>> > To unsubscribe from Bug in Date>>readFrom:pattern: ? Pharo2.0, click here.
>> > NAML
>>
>> View this message in context: Re: Bug in Date>>readFrom:pattern: ? Pharo2.0
>> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>


Reply | Threaded
Open this post in threaded view
|

Re: Bug in Date>>readFrom:pattern: ? Pharo2.0

José Comesaña
In reply to this post by Sabine Manaa
It was already discussed and modified:  https://pharo.fogbugz.com/default.asp?10869

Regards

2013/7/24 Sabine Knöfel <[hidden email]>
Hi,

Date readFrom: '4.2.13' readStream pattern: 'd.m.yy'

Does not return 4.2.2013 but 4.2.0013

The comment is saying
"A year given using only two decimals is considered to be >2000"

So, the comment is not ok or this is a bug?

Sabine



--
View this message in context: http://forum.world.st/Bug-in-Date-readFrom-pattern-Pharo2-0-tp4700427.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: Bug in Date>>readFrom:pattern: ? Pharo2.0

Marcus Denker-4

On Jul 29, 2013, at 2:34 PM, José Comesaña <[hidden email]> wrote:

> It was already discussed and modified:  https://pharo.fogbugz.com/default.asp?10869
>

This one is just an open report… no action was done. I have merged it into Issue 11222

But there is a third issue about exactly the same, this I think is from you:

10870 Corrections to Date class >>readFrom:pattern:
        https://pharo.fogbugz.com/f/cases/10870


> Regards
>
> 2013/7/24 Sabine Knöfel <[hidden email]>
> Hi,
>
> Date readFrom: '4.2.13' readStream pattern: 'd.m.yy'
>
> Does not return 4.2.2013 but 4.2.0013
>
> The comment is saying
> "A year given using only two decimals is considered to be >2000"
>
> So, the comment is not ok or this is a bug?
>
> Sabine
>
>
>
> --
> View this message in context: http://forum.world.st/Bug-in-Date-readFrom-pattern-Pharo2-0-tp4700427.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Bug in Date>>readFrom:pattern: ? Pharo2.0

José Comesaña
I think so. I think Stef created 10869 and I 10870. I had made the corrections and written the tests. Anyway, it is possible that I had made it bad. I thought I had commited the slice, but...

If you tell me how, I will do it again.

Regards


2013/7/29 Marcus Denker <[hidden email]>

On Jul 29, 2013, at 2:34 PM, José Comesaña <[hidden email]> wrote:

> It was already discussed and modified:  https://pharo.fogbugz.com/default.asp?10869
>

This one is just an open report… no action was done. I have merged it into Issue 11222

But there is a third issue about exactly the same, this I think is from you:

10870 Corrections to Date class >>readFrom:pattern:
        https://pharo.fogbugz.com/f/cases/10870


> Regards
>
> 2013/7/24 Sabine Knöfel <[hidden email]>
> Hi,
>
> Date readFrom: '4.2.13' readStream pattern: 'd.m.yy'
>
> Does not return 4.2.2013 but 4.2.0013
>
> The comment is saying
> "A year given using only two decimals is considered to be >2000"
>
> So, the comment is not ok or this is a bug?
>
> Sabine
>
>
>
> --
> View this message in context: http://forum.world.st/Bug-in-Date-readFrom-pattern-Pharo2-0-tp4700427.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>



Reply | Threaded
Open this post in threaded view
|

Re: Bug in Date>>readFrom:pattern: ? Pharo2.0

Marcus Denker-4

On Jul 30, 2013, at 12:47 AM, José Comesaña <[hidden email]> wrote:

I think so. I think Stef created 10869 and I 10870. I had made the corrections and written the tests. Anyway, it is possible that I had made it bad. I thought I had commited the slice, but...

If you tell me how, I will do it again.

What we could do now is to merge you issue into the 11222 (it has a long discussion already). And then you can commit your code as a Slice for 11222 for the others there to 
check.

Marcus


Regards


2013/7/29 Marcus Denker <[hidden email]>

On Jul 29, 2013, at 2:34 PM, José Comesaña <[hidden email]> wrote:

> It was already discussed and modified:  https://pharo.fogbugz.com/default.asp?10869
>

This one is just an open report… no action was done. I have merged it into Issue 11222

But there is a third issue about exactly the same, this I think is from you:

10870 Corrections to Date class >>readFrom:pattern:
        https://pharo.fogbugz.com/f/cases/10870


> Regards
>
> 2013/7/24 Sabine Knöfel <[hidden email]>
> Hi,
>
> Date readFrom: '4.2.13' readStream pattern: 'd.m.yy'
>
> Does not return 4.2.2013 but 4.2.0013
>
> The comment is saying
> "A year given using only two decimals is considered to be >2000"
>
> So, the comment is not ok or this is a bug?
>
> Sabine
>
>
>
> --
> View this message in context: http://forum.world.st/Bug-in-Date-readFrom-pattern-Pharo2-0-tp4700427.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>