On 24 Jul 2013, at 18:20, Stéphane Ducasse <stephane.ducasse@inria.fr> 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-decimal...
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-tp4700427p470042... 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-tp4700427p470053... 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.