In Pharo V2, if I execute this snippet: | x | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. x asTime inspect I get '12:0-54:0-53 am' which is not what I expect. DateAndTime>>asTime changed from 1.4 to 2.0. Any ideas? Thanks Donald [|] -- View this message in context: http://forum.world.st/DateAndTime-asTime-tp4691870.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
On 2013-06-06, at 00:41, dmacq <dmacq@instantiations.com> wrote:
In Pharo V2, if I execute this snippet:
| x | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. x asTime inspect
I get '12:0-54:0-53 am' which is not what I expect.
- where did you get this string from? that looks very strange. If I do what you describe in a fresh 2.0 Image I get '8:05:07 pm' as expected. - Just to be sure, which exact Pharo version are you using (print SystemVersion current)?
DateAndTime>>asTime changed from 1.4 to 2.0.
yes, the internals of DateAndTime are now in UTC and no longer local time.
Any ideas?
SystemVersion current ---> Pharo2.0 of 7 March 2013 update 20596 The string is from the inspector window. I get the same thing in a fresh image. -- View this message in context: http://forum.world.st/DateAndTime-asTime-tp4691870p4691873.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
it keeps on being strange ;), another try, what is your time zone? TimeZone local inspect TimeZone local offset inspect On 2013-06-06, at 01:14, dmacq <dmacq@instantiations.com> wrote:
SystemVersion current ---> Pharo2.0 of 7 March 2013 update 20596
The string is from the inspector window.
I get the same thing in a fresh image.
-- View this message in context: http://forum.world.st/DateAndTime-asTime-tp4691870p4691873.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
TimeZone local inspect ----> a TimeZone(LT-4:00) TimeZone local offset inspect -----> aDuration -0:04:00:00 -- View this message in context: http://forum.world.st/DateAndTime-asTime-tp4691870p4691877.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
On 2013-06-06, at 02:53, dmacq <dmacq@instantiations.com> wrote:
TimeZone local inspect ----> a TimeZone(LT-4:00) TimeZone local offset inspect -----> aDuration -0:04:00:00
that seems normal. can you upload your image somewhere (dropbox) and have an inspector open on the strange DateAndTime instance? and another try, does the following look normal? DateAndTime now asTime inspect
DateAndTime now asTime inspect -----> 8:58:38.218 pm which is correct. THis is from a virgin image (no package imports) created by unzipping the Windows download. I will try a different DateAndTime instance creation method tomorrow and let you know. This is strange. Thanks. -- View this message in context: http://forum.world.st/DateAndTime-asTime-tp4691870p4691879.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
On 05/06/13 9:02 PM, dmacq wrote:
DateAndTime now asTime inspect -----> 8:58:38.218 pm which is correct.
THis is from a virgin image (no package imports) created by unzipping the Windows download.
I will try a different DateAndTime instance creation method tomorrow and let you know.
This is strange. Thanks.
Try it again in the morning! I think it's related to time zones. If, in your local time, it is not yet midnight, but it's already the next day at GMT, then you get a negative "something" (can't remember what). I've seen the '-' (negative integer) show up in the time printString result. I think I fixed it by printing the hours/minutes/seconds with a custom print method.
I tried it again this morning and still had the problem. This is interesting. | x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x = y <------------------ True But | x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x asTime = y asTime <------------- False -- View this message in context: http://forum.world.st/DateAndTime-asTime-tp4691870p4691988.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
can you save an image with the inspector opened on both x and y, x asTime and y asTime and provide a link to it? like that I can inspect it in all detail... On 2013-06-06, at 17:51, dmacq <dmacq@instantiations.com> wrote:
I tried it again this morning and still had the problem.
This is interesting.
| x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x = y <------------------ True
But | x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x asTime = y asTime <------------- False
-- View this message in context: http://forum.world.st/DateAndTime-asTime-tp4691870p4691988.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Hello everybody. I would like to add a new improvement to this thread. I have noticed that Date class has a bug, or at least something to improve in readFrom:pattern: method. The initial comment states that "A year given using only two decimals is considered to be >2000.". But this seems to be incorrect: if you evaluate Date readFrom: '07/06/13' readStream pattern: 'd/m/y' you get: 7 June 0013 instead of 7 June 2013. I am working with version #20605 Thank you all for your great work. Regards. 2013/6/6 Camillo Bruni <camillobruni@gmail.com>
can you save an image with the inspector opened on both x and y, x asTime and y asTime and provide a link to it? like that I can inspect it in all detail...
On 2013-06-06, at 17:51, dmacq <dmacq@instantiations.com> wrote:
x = y <------------------ True
But | x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second:
I tried it again this morning and still had the problem.
This is interesting.
| x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second:
x asTime = y asTime <------------- False
-- View this message in context: http://forum.world.st/DateAndTime-asTime-tp4691870p4691988.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Hi José, On 07 Jun 2013, at 12:02, José Comesaña <jose.comesana@gmail.com> wrote:
Hello everybody.
I would like to add a new improvement to this thread.
I have noticed that Date class has a bug, or at least something to improve in readFrom:pattern: method. The initial comment states that "A year given using only two decimals is considered to be >2000.".
But this seems to be incorrect: if you evaluate
Date readFrom: '07/06/13' readStream pattern: 'd/m/y'
you get:
7 June 0013 instead of 7 June 2013.
I am working with version #20605
The fix would be quite easy: year := (inputStream next: 2) asInteger should be year := 2000 + (inputStream next: 2) asInteger A more important problem is that there are no users of #readFrom:pattern: in the system, not even unit tests. If we want to keep the methods, someone should start by writing a couple of unit tests. Sven
Thank you all for your great work.
Regards.
2013/6/6 Camillo Bruni <camillobruni@gmail.com> can you save an image with the inspector opened on both x and y, x asTime and y asTime and provide a link to it? like that I can inspect it in all detail...
On 2013-06-06, at 17:51, dmacq <dmacq@instantiations.com> wrote:
I tried it again this morning and still had the problem.
This is interesting.
| x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x = y <------------------ True
But | x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x asTime = y asTime <------------- False
-- View this message in context: http://forum.world.st/DateAndTime-asTime-tp4691870p4691988.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Thank you Sven. I had made the fixes myself, creating a new class for dates (I don't need the complexity of Date just for determining if a date is past, I don't need date arithmetic either). I just wanted to inform, mainly because the bug seems to be still present in Pharo 3.0. Anyway, your solution does not work for the 'd/m/y' pattern, although it does for 'd/m/yy'. I could write the tests you suggest, if you think they are interesting. Regards 2013/6/7 Sven Van Caekenberghe <sven@stfx.eu>
Hi José,
On 07 Jun 2013, at 12:02, José Comesaña <jose.comesana@gmail.com> wrote:
Hello everybody.
I would like to add a new improvement to this thread.
I have noticed that Date class has a bug, or at least something to improve in readFrom:pattern: method. The initial comment states that "A year given using only two decimals is considered to be >2000.".
But this seems to be incorrect: if you evaluate
Date readFrom: '07/06/13' readStream pattern: 'd/m/y'
you get:
7 June 0013 instead of 7 June 2013.
I am working with version #20605
The fix would be quite easy:
year := (inputStream next: 2) asInteger
should be
year := 2000 + (inputStream next: 2) asInteger
A more important problem is that there are no users of #readFrom:pattern: in the system, not even unit tests. If we want to keep the methods, someone should start by writing a couple of unit tests.
Sven
Thank you all for your great work.
Regards.
2013/6/6 Camillo Bruni <camillobruni@gmail.com> can you save an image with the inspector opened on both x and y, x asTime and y asTime and provide a link to it? like that I can inspect it in all detail...
On 2013-06-06, at 17:51, dmacq <dmacq@instantiations.com> wrote:
I tried it again this morning and still had the problem.
This is interesting.
| x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x = y <------------------ True
But | x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x asTime = y asTime <------------- False
-- View this message in context: http://forum.world.st/DateAndTime-asTime-tp4691870p4691988.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
On 07 Jun 2013, at 13:26, José Comesaña <jose.comesana@gmail.com> wrote:
Thank you Sven.
I had made the fixes myself, creating a new class for dates (I don't need the complexity of Date just for determining if a date is past, I don't need date arithmetic either). I just wanted to inform, mainly because the bug seems to be still present in Pharo 3.0.
Anyway, your solution does not work for the 'd/m/y' pattern, although it does for 'd/m/yy'.
Depends on what a single y means, right ?
I could write the tests you suggest, if you think they are interesting.
Yes, please do: with a good set of tests, we can discuss using concrete examples.
Regards
2013/6/7 Sven Van Caekenberghe <sven@stfx.eu> Hi José,
On 07 Jun 2013, at 12:02, José Comesaña <jose.comesana@gmail.com> wrote:
Hello everybody.
I would like to add a new improvement to this thread.
I have noticed that Date class has a bug, or at least something to improve in readFrom:pattern: method. The initial comment states that "A year given using only two decimals is considered to be >2000.".
But this seems to be incorrect: if you evaluate
Date readFrom: '07/06/13' readStream pattern: 'd/m/y'
you get:
7 June 0013 instead of 7 June 2013.
I am working with version #20605
The fix would be quite easy:
year := (inputStream next: 2) asInteger
should be
year := 2000 + (inputStream next: 2) asInteger
A more important problem is that there are no users of #readFrom:pattern: in the system, not even unit tests. If we want to keep the methods, someone should start by writing a couple of unit tests.
Sven
Thank you all for your great work.
Regards.
2013/6/6 Camillo Bruni <camillobruni@gmail.com> can you save an image with the inspector opened on both x and y, x asTime and y asTime and provide a link to it? like that I can inspect it in all detail...
On 2013-06-06, at 17:51, dmacq <dmacq@instantiations.com> wrote:
I tried it again this morning and still had the problem.
This is interesting.
| x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x = y <------------------ True
But | x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x asTime = y asTime <------------- False
-- View this message in context: http://forum.world.st/DateAndTime-asTime-tp4691870p4691988.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Answers in red. Regards 2013/6/7 Sven Van Caekenberghe <sven@stfx.eu>
On 07 Jun 2013, at 13:26, José Comesaña <jose.comesana@gmail.com> wrote:
Thank you Sven.
I had made the fixes myself, creating a new class for dates (I don't need the complexity of Date just for determining if a date is past, I don't need date arithmetic either). I just wanted to inform, mainly because the bug seems to be still present in Pharo 3.0.
Anyway, your solution does not work for the 'd/m/y' pattern, although it does for 'd/m/yy'.
Depends on what a single y means, right ?
According to documentation, one y means ...year, no matter how many digits supplied... (my own words, not litteral). It means it will either accept ../../13 or ../../2013
I could write the tests you suggest, if you think they are interesting.
Yes, please do: with a good set of tests, we can discuss using concrete examples.
Sure I will. Will keep you informed!
Regards
2013/6/7 Sven Van Caekenberghe <sven@stfx.eu> Hi José,
On 07 Jun 2013, at 12:02, José Comesaña <jose.comesana@gmail.com> wrote:
Hello everybody.
I would like to add a new improvement to this thread.
I have noticed that Date class has a bug, or at least something to improve in readFrom:pattern: method. The initial comment states that "A year given using only two decimals is considered to be >2000.".
But this seems to be incorrect: if you evaluate
Date readFrom: '07/06/13' readStream pattern: 'd/m/y'
you get:
7 June 0013 instead of 7 June 2013.
I am working with version #20605
The fix would be quite easy:
year := (inputStream next: 2) asInteger
should be
year := 2000 + (inputStream next: 2) asInteger
A more important problem is that there are no users of #readFrom:pattern: in the system, not even unit tests. If we want to keep the methods, someone should start by writing a couple of unit tests.
Sven
Thank you all for your great work.
Regards.
2013/6/6 Camillo Bruni <camillobruni@gmail.com> can you save an image with the inspector opened on both x and y, x asTime and y asTime and provide a link to it? like that I can inspect it in all detail...
On 2013-06-06, at 17:51, dmacq <dmacq@instantiations.com> wrote:
I tried it again this morning and still had the problem.
This is interesting.
| x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x = y <------------------ True
But | x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x asTime = y asTime <------------- False
-- View this message in context: http://forum.world.st/DateAndTime-asTime-tp4691870p4691988.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
On 07 Jun 2013, at 14:28, José Comesaña <jose.comesana@gmail.com> wrote:
Answers in red.
Regards
2013/6/7 Sven Van Caekenberghe <sven@stfx.eu>
On 07 Jun 2013, at 13:26, José Comesaña <jose.comesana@gmail.com> wrote:
Thank you Sven.
I had made the fixes myself, creating a new class for dates (I don't need the complexity of Date just for determining if a date is past, I don't need date arithmetic either). I just wanted to inform, mainly because the bug seems to be still present in Pharo 3.0.
Anyway, your solution does not work for the 'd/m/y' pattern, although it does for 'd/m/yy'.
Depends on what a single y means, right ?
According to documentation, one y means ...year, no matter how many digits supplied... (my own words, not litteral). It means it will either accept ../../13 or ../../2013
Yes, that is how I understood it as well. My change adds 2000 only in the case of 2 y's unless I am mistaken. But I must admin I didn't test it.
I could write the tests you suggest, if you think they are interesting.
Yes, please do: with a good set of tests, we can discuss using concrete examples.
Sure I will. Will keep you informed!
Super.
Regards
2013/6/7 Sven Van Caekenberghe <sven@stfx.eu> Hi José,
On 07 Jun 2013, at 12:02, José Comesaña <jose.comesana@gmail.com> wrote:
Hello everybody.
I would like to add a new improvement to this thread.
I have noticed that Date class has a bug, or at least something to improve in readFrom:pattern: method. The initial comment states that "A year given using only two decimals is considered to be >2000.".
But this seems to be incorrect: if you evaluate
Date readFrom: '07/06/13' readStream pattern: 'd/m/y'
you get:
7 June 0013 instead of 7 June 2013.
I am working with version #20605
The fix would be quite easy:
year := (inputStream next: 2) asInteger
should be
year := 2000 + (inputStream next: 2) asInteger
A more important problem is that there are no users of #readFrom:pattern: in the system, not even unit tests. If we want to keep the methods, someone should start by writing a couple of unit tests.
Sven
Thank you all for your great work.
Regards.
2013/6/6 Camillo Bruni <camillobruni@gmail.com> can you save an image with the inspector opened on both x and y, x asTime and y asTime and provide a link to it? like that I can inspect it in all detail...
On 2013-06-06, at 17:51, dmacq <dmacq@instantiations.com> wrote:
I tried it again this morning and still had the problem.
This is interesting.
| x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x = y <------------------ True
But | x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x asTime = y asTime <------------- False
-- View this message in context: http://forum.world.st/DateAndTime-asTime-tp4691870p4691988.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Hi again. I have one first test for #readFrom:pattern:. What can I do now to send it, where, to whom?. Regards 2013/6/7 Sven Van Caekenberghe <sven@stfx.eu>
On 07 Jun 2013, at 14:28, José Comesaña <jose.comesana@gmail.com> wrote:
Answers in red.
Regards
2013/6/7 Sven Van Caekenberghe <sven@stfx.eu>
On 07 Jun 2013, at 13:26, José Comesaña <jose.comesana@gmail.com> wrote:
Thank you Sven.
I had made the fixes myself, creating a new class for dates (I don't need the complexity of Date just for determining if a date is past, I don't need date arithmetic either). I just wanted to inform, mainly because the bug seems to be still present in Pharo 3.0.
Anyway, your solution does not work for the 'd/m/y' pattern, although it does for 'd/m/yy'.
Depends on what a single y means, right ?
According to documentation, one y means ...year, no matter how many digits supplied... (my own words, not litteral). It means it will either accept ../../13 or ../../2013
Yes, that is how I understood it as well. My change adds 2000 only in the case of 2 y's unless I am mistaken. But I must admin I didn't test it.
I could write the tests you suggest, if you think they are interesting.
Yes, please do: with a good set of tests, we can discuss using concrete examples.
Sure I will. Will keep you informed!
Super.
Regards
2013/6/7 Sven Van Caekenberghe <sven@stfx.eu> Hi José,
On 07 Jun 2013, at 12:02, José Comesaña <jose.comesana@gmail.com> wrote:
Hello everybody.
I would like to add a new improvement to this thread.
I have noticed that Date class has a bug, or at least something to improve in readFrom:pattern: method. The initial comment states that "A year given using only two decimals is considered to be >2000.".
But this seems to be incorrect: if you evaluate
Date readFrom: '07/06/13' readStream pattern: 'd/m/y'
you get:
7 June 0013 instead of 7 June 2013.
I am working with version #20605
The fix would be quite easy:
year := (inputStream next: 2) asInteger
should be
year := 2000 + (inputStream next: 2) asInteger
A more important problem is that there are no users of #readFrom:pattern: in the system, not even unit tests. If we want to keep the methods, someone should start by writing a couple of unit tests.
Sven
Thank you all for your great work.
Regards.
2013/6/6 Camillo Bruni <camillobruni@gmail.com> can you save an image with the inspector opened on both x and y, x asTime and y asTime and provide a link to it? like that I can inspect it in all detail...
On 2013-06-06, at 17:51, dmacq <dmacq@instantiations.com> wrote:
I tried it again this morning and still had the problem.
This is interesting.
| x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x = y <------------------ True
But | x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x asTime = y asTime <------------- False
-- View this message in context: http://forum.world.st/DateAndTime-asTime-tp4691870p4691988.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Hi again.
I have one first test for #readFrom:pattern:. What can I do now to send it, where, to whom?.
I will create a bug entry for you and you create a slice with the test and the fix and you publish it in the pharo inbox. Stef
Regards
2013/6/7 Sven Van Caekenberghe <sven@stfx.eu>
On 07 Jun 2013, at 14:28, José Comesaña <jose.comesana@gmail.com> wrote:
Answers in red.
Regards
2013/6/7 Sven Van Caekenberghe <sven@stfx.eu>
On 07 Jun 2013, at 13:26, José Comesaña <jose.comesana@gmail.com> wrote:
Thank you Sven.
I had made the fixes myself, creating a new class for dates (I don't need the complexity of Date just for determining if a date is past, I don't need date arithmetic either). I just wanted to inform, mainly because the bug seems to be still present in Pharo 3.0.
Anyway, your solution does not work for the 'd/m/y' pattern, although it does for 'd/m/yy'.
Depends on what a single y means, right ?
According to documentation, one y means ...year, no matter how many digits supplied... (my own words, not litteral). It means it will either accept ../../13 or ../../2013
Yes, that is how I understood it as well. My change adds 2000 only in the case of 2 y's unless I am mistaken. But I must admin I didn't test it.
I could write the tests you suggest, if you think they are interesting.
Yes, please do: with a good set of tests, we can discuss using concrete examples.
Sure I will. Will keep you informed!
Super.
Regards
2013/6/7 Sven Van Caekenberghe <sven@stfx.eu> Hi José,
On 07 Jun 2013, at 12:02, José Comesaña <jose.comesana@gmail.com> wrote:
Hello everybody.
I would like to add a new improvement to this thread.
I have noticed that Date class has a bug, or at least something to improve in readFrom:pattern: method. The initial comment states that "A year given using only two decimals is considered to be >2000.".
But this seems to be incorrect: if you evaluate
Date readFrom: '07/06/13' readStream pattern: 'd/m/y'
you get:
7 June 0013 instead of 7 June 2013.
I am working with version #20605
The fix would be quite easy:
year := (inputStream next: 2) asInteger
should be
year := 2000 + (inputStream next: 2) asInteger
A more important problem is that there are no users of #readFrom:pattern: in the system, not even unit tests. If we want to keep the methods, someone should start by writing a couple of unit tests.
Sven
Thank you all for your great work.
Regards.
2013/6/6 Camillo Bruni <camillobruni@gmail.com> can you save an image with the inspector opened on both x and y, x asTime and y asTime and provide a link to it? like that I can inspect it in all detail...
On 2013-06-06, at 17:51, dmacq <dmacq@instantiations.com> wrote:
I tried it again this morning and still had the problem.
This is interesting.
| x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x = y <------------------ True
But | x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x asTime = y asTime <------------- False
-- View this message in context: http://forum.world.st/DateAndTime-asTime-tp4691870p4691988.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Here it is https://pharo.fogbugz.com/default.asp?10869 Stef On Jun 7, 2013, at 8:17 PM, Stéphane Ducasse <Stephane.Ducasse@inria.fr> wrote:
Hi again.
I have one first test for #readFrom:pattern:. What can I do now to send it, where, to whom?.
I will create a bug entry for you and you create a slice with the test and the fix and you publish it in the pharo inbox.
Stef
Regards
2013/6/7 Sven Van Caekenberghe <sven@stfx.eu>
On 07 Jun 2013, at 14:28, José Comesaña <jose.comesana@gmail.com> wrote:
Answers in red.
Regards
2013/6/7 Sven Van Caekenberghe <sven@stfx.eu>
On 07 Jun 2013, at 13:26, José Comesaña <jose.comesana@gmail.com> wrote:
Thank you Sven.
I had made the fixes myself, creating a new class for dates (I don't need the complexity of Date just for determining if a date is past, I don't need date arithmetic either). I just wanted to inform, mainly because the bug seems to be still present in Pharo 3.0.
Anyway, your solution does not work for the 'd/m/y' pattern, although it does for 'd/m/yy'.
Depends on what a single y means, right ?
According to documentation, one y means ...year, no matter how many digits supplied... (my own words, not litteral). It means it will either accept ../../13 or ../../2013
Yes, that is how I understood it as well. My change adds 2000 only in the case of 2 y's unless I am mistaken. But I must admin I didn't test it.
I could write the tests you suggest, if you think they are interesting.
Yes, please do: with a good set of tests, we can discuss using concrete examples.
Sure I will. Will keep you informed!
Super.
Regards
2013/6/7 Sven Van Caekenberghe <sven@stfx.eu> Hi José,
On 07 Jun 2013, at 12:02, José Comesaña <jose.comesana@gmail.com> wrote:
Hello everybody.
I would like to add a new improvement to this thread.
I have noticed that Date class has a bug, or at least something to improve in readFrom:pattern: method. The initial comment states that "A year given using only two decimals is considered to be >2000.".
But this seems to be incorrect: if you evaluate
Date readFrom: '07/06/13' readStream pattern: 'd/m/y'
you get:
7 June 0013 instead of 7 June 2013.
I am working with version #20605
The fix would be quite easy:
year := (inputStream next: 2) asInteger
should be
year := 2000 + (inputStream next: 2) asInteger
A more important problem is that there are no users of #readFrom:pattern: in the system, not even unit tests. If we want to keep the methods, someone should start by writing a couple of unit tests.
Sven
Thank you all for your great work.
Regards.
2013/6/6 Camillo Bruni <camillobruni@gmail.com> can you save an image with the inspector opened on both x and y, x asTime and y asTime and provide a link to it? like that I can inspect it in all detail...
On 2013-06-06, at 17:51, dmacq <dmacq@instantiations.com> wrote:
I tried it again this morning and still had the problem.
This is interesting.
| x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x = y <------------------ True
But | x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x asTime = y asTime <------------- False
-- View this message in context: http://forum.world.st/DateAndTime-asTime-tp4691870p4691988.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Done. I hope I have made it correctly. If not, please tell me. Regards 2013/6/7 Stéphane Ducasse <stephane.ducasse@inria.fr>
Here it is https://pharo.fogbugz.com/default.asp?10869
Stef
On Jun 7, 2013, at 8:17 PM, Stéphane Ducasse <Stephane.Ducasse@inria.fr> wrote:
Hi again.
I have one first test for #readFrom:pattern:. What can I do now to send it, where, to whom?.
I will create a bug entry for you and you create a slice with the test and the fix and you publish it in the pharo inbox.
Stef
Regards
2013/6/7 Sven Van Caekenberghe <sven@stfx.eu>
On 07 Jun 2013, at 14:28, José Comesaña <jose.comesana@gmail.com> wrote:
Answers in red.
Regards
2013/6/7 Sven Van Caekenberghe <sven@stfx.eu>
On 07 Jun 2013, at 13:26, José Comesaña <jose.comesana@gmail.com> wrote:
Thank you Sven.
I had made the fixes myself, creating a new class for dates (I don't need the complexity of Date just for determining if a date is past, I don't need date arithmetic either). I just wanted to inform, mainly because the bug seems to be still present in Pharo 3.0.
Anyway, your solution does not work for the 'd/m/y' pattern, although it does for 'd/m/yy'.
Depends on what a single y means, right ?
According to documentation, one y means ...year, no matter how many digits supplied... (my own words, not litteral). It means it will either accept ../../13 or ../../2013
Yes, that is how I understood it as well. My change adds 2000 only in the case of 2 y's unless I am mistaken. But I must admin I didn't test it.
I could write the tests you suggest, if you think they are interesting.
Yes, please do: with a good set of tests, we can discuss using concrete examples.
Sure I will. Will keep you informed!
Super.
Regards
2013/6/7 Sven Van Caekenberghe <sven@stfx.eu> Hi José,
On 07 Jun 2013, at 12:02, José Comesaña <jose.comesana@gmail.com> wrote:
Hello everybody.
I would like to add a new improvement to this thread.
I have noticed that Date class has a bug, or at least something to improve in readFrom:pattern: method. The initial comment states that "A year given using only two decimals is considered to be >2000.".
But this seems to be incorrect: if you evaluate
Date readFrom: '07/06/13' readStream pattern: 'd/m/y'
you get:
7 June 0013 instead of 7 June 2013.
I am working with version #20605
The fix would be quite easy:
year := (inputStream next: 2) asInteger
should be
year := 2000 + (inputStream next: 2) asInteger
A more important problem is that there are no users of #readFrom:pattern: in the system, not even unit tests. If we want to keep the methods, someone should start by writing a couple of unit tests.
Sven
Thank you all for your great work.
Regards.
2013/6/6 Camillo Bruni <camillobruni@gmail.com> can you save an image with the inspector opened on both x and y, x asTime and y asTime and provide a link to it? like that I can inspect it in all detail...
On 2013-06-06, at 17:51, dmacq <dmacq@instantiations.com> wrote:
I tried it again this morning and still had the problem.
This is interesting.
| x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x = y <------------------ True
But | x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x asTime = y asTime <------------- False
-- View this message in context: http://forum.world.st/DateAndTime-asTime-tp4691870p4691988.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com <http://nabble.com/>.
tx I will look at it. Stef On Jun 7, 2013, at 8:57 PM, José Comesaña <jose.comesana@gmail.com> wrote:
Done.
I hope I have made it correctly. If not, please tell me.
Regards
2013/6/7 Stéphane Ducasse <stephane.ducasse@inria.fr> Here it is https://pharo.fogbugz.com/default.asp?10869
Stef
On Jun 7, 2013, at 8:17 PM, Stéphane Ducasse <Stephane.Ducasse@inria.fr> wrote:
Hi again.
I have one first test for #readFrom:pattern:. What can I do now to send it, where, to whom?.
I will create a bug entry for you and you create a slice with the test and the fix and you publish it in the pharo inbox.
Stef
Regards
2013/6/7 Sven Van Caekenberghe <sven@stfx.eu>
On 07 Jun 2013, at 14:28, José Comesaña <jose.comesana@gmail.com> wrote:
Answers in red.
Regards
2013/6/7 Sven Van Caekenberghe <sven@stfx.eu>
On 07 Jun 2013, at 13:26, José Comesaña <jose.comesana@gmail.com> wrote:
Thank you Sven.
I had made the fixes myself, creating a new class for dates (I don't need the complexity of Date just for determining if a date is past, I don't need date arithmetic either). I just wanted to inform, mainly because the bug seems to be still present in Pharo 3.0.
Anyway, your solution does not work for the 'd/m/y' pattern, although it does for 'd/m/yy'.
Depends on what a single y means, right ?
According to documentation, one y means ...year, no matter how many digits supplied... (my own words, not litteral). It means it will either accept ../../13 or ../../2013
Yes, that is how I understood it as well. My change adds 2000 only in the case of 2 y's unless I am mistaken. But I must admin I didn't test it.
I could write the tests you suggest, if you think they are interesting.
Yes, please do: with a good set of tests, we can discuss using concrete examples.
Sure I will. Will keep you informed!
Super.
Regards
2013/6/7 Sven Van Caekenberghe <sven@stfx.eu> Hi José,
On 07 Jun 2013, at 12:02, José Comesaña <jose.comesana@gmail.com> wrote:
Hello everybody.
I would like to add a new improvement to this thread.
I have noticed that Date class has a bug, or at least something to improve in readFrom:pattern: method. The initial comment states that "A year given using only two decimals is considered to be >2000.".
But this seems to be incorrect: if you evaluate
Date readFrom: '07/06/13' readStream pattern: 'd/m/y'
you get:
7 June 0013 instead of 7 June 2013.
I am working with version #20605
The fix would be quite easy:
year := (inputStream next: 2) asInteger
should be
year := 2000 + (inputStream next: 2) asInteger
A more important problem is that there are no users of #readFrom:pattern: in the system, not even unit tests. If we want to keep the methods, someone should start by writing a couple of unit tests.
Sven
Thank you all for your great work.
Regards.
2013/6/6 Camillo Bruni <camillobruni@gmail.com> can you save an image with the inspector opened on both x and y, x asTime and y asTime and provide a link to it? like that I can inspect it in all detail...
On 2013-06-06, at 17:51, dmacq <dmacq@instantiations.com> wrote:
I tried it again this morning and still had the problem.
This is interesting.
| x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x = y <------------------ True
But | x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x asTime = y asTime <------------- False
-- View this message in context: http://forum.world.st/DateAndTime-asTime-tp4691870p4691988.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Jose normally we do not summit code in the pane of the bug tracker, we commit a slice (click + slice in the monticello browser) in the inbox folder. Stef On Jun 7, 2013, at 9:12 PM, Stéphane Ducasse <Stephane.Ducasse@inria.fr> wrote:
tx I will look at it.
Stef
On Jun 7, 2013, at 8:57 PM, José Comesaña <jose.comesana@gmail.com> wrote:
Done.
I hope I have made it correctly. If not, please tell me.
Regards
2013/6/7 Stéphane Ducasse <stephane.ducasse@inria.fr> Here it is https://pharo.fogbugz.com/default.asp?10869
Stef
On Jun 7, 2013, at 8:17 PM, Stéphane Ducasse <Stephane.Ducasse@inria.fr> wrote:
Hi again.
I have one first test for #readFrom:pattern:. What can I do now to send it, where, to whom?.
I will create a bug entry for you and you create a slice with the test and the fix and you publish it in the pharo inbox.
Stef
Regards
2013/6/7 Sven Van Caekenberghe <sven@stfx.eu>
On 07 Jun 2013, at 14:28, José Comesaña <jose.comesana@gmail.com> wrote:
Answers in red.
Regards
2013/6/7 Sven Van Caekenberghe <sven@stfx.eu>
On 07 Jun 2013, at 13:26, José Comesaña <jose.comesana@gmail.com> wrote:
Thank you Sven.
I had made the fixes myself, creating a new class for dates (I don't need the complexity of Date just for determining if a date is past, I don't need date arithmetic either). I just wanted to inform, mainly because the bug seems to be still present in Pharo 3.0.
Anyway, your solution does not work for the 'd/m/y' pattern, although it does for 'd/m/yy'.
Depends on what a single y means, right ?
According to documentation, one y means ...year, no matter how many digits supplied... (my own words, not litteral). It means it will either accept ../../13 or ../../2013
Yes, that is how I understood it as well. My change adds 2000 only in the case of 2 y's unless I am mistaken. But I must admin I didn't test it.
I could write the tests you suggest, if you think they are interesting.
Yes, please do: with a good set of tests, we can discuss using concrete examples.
Sure I will. Will keep you informed!
Super.
Regards
2013/6/7 Sven Van Caekenberghe <sven@stfx.eu> Hi José,
On 07 Jun 2013, at 12:02, José Comesaña <jose.comesana@gmail.com> wrote:
Hello everybody.
I would like to add a new improvement to this thread.
I have noticed that Date class has a bug, or at least something to improve in readFrom:pattern: method. The initial comment states that "A year given using only two decimals is considered to be >2000.".
But this seems to be incorrect: if you evaluate
Date readFrom: '07/06/13' readStream pattern: 'd/m/y'
you get:
7 June 0013 instead of 7 June 2013.
I am working with version #20605
The fix would be quite easy:
year := (inputStream next: 2) asInteger
should be
year := 2000 + (inputStream next: 2) asInteger
A more important problem is that there are no users of #readFrom:pattern: in the system, not even unit tests. If we want to keep the methods, someone should start by writing a couple of unit tests.
Sven
Thank you all for your great work.
Regards.
2013/6/6 Camillo Bruni <camillobruni@gmail.com> can you save an image with the inspector opened on both x and y, x asTime and y asTime and provide a link to it? like that I can inspect it in all detail...
On 2013-06-06, at 17:51, dmacq <dmacq@instantiations.com> wrote:
I tried it again this morning and still had the problem.
This is interesting.
| x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x = y <------------------ True
But | x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x asTime = y asTime <------------- False
-- View this message in context: http://forum.world.st/DateAndTime-asTime-tp4691870p4691988.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Ok, I will correct it tomorrow. Txs El 07/06/2013, a las 21:45, Stéphane Ducasse <stephane.ducasse@inria.fr> escribió:
Jose
normally we do not summit code in the pane of the bug tracker, we commit a slice (click + slice in the monticello browser) in the inbox folder.
Stef
On Jun 7, 2013, at 9:12 PM, Stéphane Ducasse <Stephane.Ducasse@inria.fr> wrote:
tx I will look at it.
Stef
On Jun 7, 2013, at 8:57 PM, José Comesaña <jose.comesana@gmail.com> wrote:
Done.
I hope I have made it correctly. If not, please tell me.
Regards
2013/6/7 Stéphane Ducasse <stephane.ducasse@inria.fr>
Here it is https://pharo.fogbugz.com/default.asp?10869
Stef
On Jun 7, 2013, at 8:17 PM, Stéphane Ducasse <Stephane.Ducasse@inria.fr> wrote:
Hi again.
I have one first test for #readFrom:pattern:. What can I do now to send it, where, to whom?.
I will create a bug entry for you and you create a slice with the test and the fix and you publish it in the pharo inbox.
Stef
Regards
2013/6/7 Sven Van Caekenberghe <sven@stfx.eu>
On 07 Jun 2013, at 14:28, José Comesaña <jose.comesana@gmail.com> wrote:
Answers in red.
Regards
2013/6/7 Sven Van Caekenberghe <sven@stfx.eu>
On 07 Jun 2013, at 13:26, José Comesaña <jose.comesana@gmail.com> wrote:
Thank you Sven.
I had made the fixes myself, creating a new class for dates (I don't need the complexity of Date just for determining if a date is past, I don't need date arithmetic either). I just wanted to inform, mainly because the bug seems to be still present in Pharo 3.0.
Anyway, your solution does not work for the 'd/m/y' pattern, although it does for 'd/m/yy'.
Depends on what a single y means, right ?
According to documentation, one y means ...year, no matter how many digits supplied... (my own words, not litteral). It means it will either accept ../../13 or ../../2013
Yes, that is how I understood it as well. My change adds 2000 only in the case of 2 y's unless I am mistaken. But I must admin I didn't test it.
I could write the tests you suggest, if you think they are interesting.
Yes, please do: with a good set of tests, we can discuss using concrete examples.
Sure I will. Will keep you informed!
Super.
Regards
2013/6/7 Sven Van Caekenberghe <sven@stfx.eu> Hi José,
On 07 Jun 2013, at 12:02, José Comesaña <jose.comesana@gmail.com> wrote:
Hello everybody.
I would like to add a new improvement to this thread.
I have noticed that Date class has a bug, or at least something to improve in readFrom:pattern: method. The initial comment states that "A year given using only two decimals is considered to be >2000.".
But this seems to be incorrect: if you evaluate
Date readFrom: '07/06/13' readStream pattern: 'd/m/y'
you get:
7 June 0013 instead of 7 June 2013.
I am working with version #20605
The fix would be quite easy:
year := (inputStream next: 2) asInteger
should be
year := 2000 + (inputStream next: 2) asInteger
A more important problem is that there are no users of #readFrom:pattern: in the system, not even unit tests. If we want to keep the methods, someone should start by writing a couple of unit tests.
Sven
Thank you all for your great work.
Regards.
2013/6/6 Camillo Bruni <camillobruni@gmail.com> can you save an image with the inspector opened on both x and y, x asTime and y asTime and provide a link to it? like that I can inspect it in all detail...
On 2013-06-06, at 17:51, dmacq <dmacq@instantiations.com> wrote:
I tried it again this morning and still had the problem.
This is interesting.
| x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x = y <------------------ True
But | x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x asTime = y asTime <------------- False
-- View this message in context: http://forum.world.st/DateAndTime-asTime-tp4691870p4691988.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
thanks :) This is less work for us and the process can automatically check the code and run the tests automatically. Stef On Jun 7, 2013, at 10:16 PM, José Comesaña <jose.comesana@gmail.com> wrote:
Ok, I will correct it tomorrow.
Txs
El 07/06/2013, a las 21:45, Stéphane Ducasse <stephane.ducasse@inria.fr> escribió:
Jose
normally we do not summit code in the pane of the bug tracker, we commit a slice (click + slice in the monticello browser) in the inbox folder.
Stef
On Jun 7, 2013, at 9:12 PM, Stéphane Ducasse <Stephane.Ducasse@inria.fr> wrote:
tx I will look at it.
Stef
On Jun 7, 2013, at 8:57 PM, José Comesaña <jose.comesana@gmail.com> wrote:
Done.
I hope I have made it correctly. If not, please tell me.
Regards
2013/6/7 Stéphane Ducasse <stephane.ducasse@inria.fr> Here it is https://pharo.fogbugz.com/default.asp?10869
Stef
On Jun 7, 2013, at 8:17 PM, Stéphane Ducasse <Stephane.Ducasse@inria.fr> wrote:
Hi again.
I have one first test for #readFrom:pattern:. What can I do now to send it, where, to whom?.
I will create a bug entry for you and you create a slice with the test and the fix and you publish it in the pharo inbox.
Stef
Regards
2013/6/7 Sven Van Caekenberghe <sven@stfx.eu>
On 07 Jun 2013, at 14:28, José Comesaña <jose.comesana@gmail.com> wrote:
Answers in red.
Regards
2013/6/7 Sven Van Caekenberghe <sven@stfx.eu>
On 07 Jun 2013, at 13:26, José Comesaña <jose.comesana@gmail.com> wrote:
Thank you Sven.
I had made the fixes myself, creating a new class for dates (I don't need the complexity of Date just for determining if a date is past, I don't need date arithmetic either). I just wanted to inform, mainly because the bug seems to be still present in Pharo 3.0.
Anyway, your solution does not work for the 'd/m/y' pattern, although it does for 'd/m/yy'.
Depends on what a single y means, right ?
According to documentation, one y means ...year, no matter how many digits supplied... (my own words, not litteral). It means it will either accept ../../13 or ../../2013
Yes, that is how I understood it as well. My change adds 2000 only in the case of 2 y's unless I am mistaken. But I must admin I didn't test it.
I could write the tests you suggest, if you think they are interesting.
Yes, please do: with a good set of tests, we can discuss using concrete examples.
Sure I will. Will keep you informed!
Super.
Regards
2013/6/7 Sven Van Caekenberghe <sven@stfx.eu> Hi José,
On 07 Jun 2013, at 12:02, José Comesaña <jose.comesana@gmail.com> wrote:
Hello everybody.
I would like to add a new improvement to this thread.
I have noticed that Date class has a bug, or at least something to improve in readFrom:pattern: method. The initial comment states that "A year given using only two decimals is considered to be >2000.".
But this seems to be incorrect: if you evaluate
Date readFrom: '07/06/13' readStream pattern: 'd/m/y'
you get:
7 June 0013 instead of 7 June 2013.
I am working with version #20605
The fix would be quite easy:
year := (inputStream next: 2) asInteger
should be
year := 2000 + (inputStream next: 2) asInteger
A more important problem is that there are no users of #readFrom:pattern: in the system, not even unit tests. If we want to keep the methods, someone should start by writing a couple of unit tests.
Sven
Thank you all for your great work.
Regards.
2013/6/6 Camillo Bruni <camillobruni@gmail.com> can you save an image with the inspector opened on both x and y, x asTime and y asTime and provide a link to it? like that I can inspect it in all detail...
On 2013-06-06, at 17:51, dmacq <dmacq@instantiations.com> wrote:
I tried it again this morning and still had the problem.
This is interesting.
| x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x = y <------------------ True
But | x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x asTime = y asTime <------------- False
-- View this message in context: http://forum.world.st/DateAndTime-asTime-tp4691870p4691988.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
you are welcome :) On Jun 9, 2013, at 12:53 PM, José Comesaña <jose.comesana@gmail.com> wrote:
Done.
Sorry for my ignorance, :).
Thanks
2013/6/7 Stéphane Ducasse <stephane.ducasse@inria.fr> thanks :) This is less work for us and the process can automatically check the code and run the tests automatically. Stef
I had made the fixes myself, creating a new class for dates (I don't need the complexity of Date just for determining if a date is past, I don't need date arithmetic either). I just wanted to inform, mainly because the bug seems to be still present in Pharo 3.0.
Anyway, your solution does not work for the 'd/m/y' pattern, although it does for 'd/m/yy'.
Depends on what a single y means, right ?
I could write the tests you suggest, if you think they are interesting.
Yes, please do: with a good set of tests, we can discuss using concrete examples.
Please :) We love tests!
can you open a bug entry and publish a slice so that we do not fix it. Stef On Jun 7, 2013, at 12:36 PM, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Hi José,
On 07 Jun 2013, at 12:02, José Comesaña <jose.comesana@gmail.com> wrote:
Hello everybody.
I would like to add a new improvement to this thread.
I have noticed that Date class has a bug, or at least something to improve in readFrom:pattern: method. The initial comment states that "A year given using only two decimals is considered to be >2000.".
But this seems to be incorrect: if you evaluate
Date readFrom: '07/06/13' readStream pattern: 'd/m/y'
you get:
7 June 0013 instead of 7 June 2013.
I am working with version #20605
The fix would be quite easy:
year := (inputStream next: 2) asInteger
should be
year := 2000 + (inputStream next: 2) asInteger
A more important problem is that there are no users of #readFrom:pattern: in the system, not even unit tests. If we want to keep the methods, someone should start by writing a couple of unit tests.
Sven
Thank you all for your great work.
Regards.
2013/6/6 Camillo Bruni <camillobruni@gmail.com> can you save an image with the inspector opened on both x and y, x asTime and y asTime and provide a link to it? like that I can inspect it in all detail...
On 2013-06-06, at 17:51, dmacq <dmacq@instantiations.com> wrote:
I tried it again this morning and still had the problem.
This is interesting.
| x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x = y <------------------ True
But | x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x asTime = y asTime <------------- False
-- View this message in context: http://forum.world.st/DateAndTime-asTime-tp4691870p4691988.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
On 6/6/2013 2:14 PM, Camillo Bruni wrote:
can you save an image with the inspector opened on both x and y, x asTime and y asTime and provide a link to it? like that I can inspect it in all detail...
yes. probably tomorrow. please ping me if I forget. thanks
On 2013-06-06, at 17:51, dmacq <dmacq@instantiations.com> wrote:
I tried it again this morning and still had the problem.
This is interesting.
| x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x = y <------------------ True
But | x y | x := DateAndTime year: 1991 day: 196 hour: 20 minute: 5 second: 7. y := DateAndTime year: 1991 month: 7 day: 15 hour: 20 minute: 5 second: 7. x asTime = y asTime <------------- False
-- View this message in context: http://forum.world.st/DateAndTime-asTime-tp4691870p4691988.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
-- Donald [|] A bad day in [] is better than a good day in {}
participants (7)
-
Camillo Bruni -
dmacq -
Donald -
José Comesaña -
Stéphane Ducasse -
Sven Van Caekenberghe -
Yanni Chiu