Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
HistoricalDate
Last updated at 1:12 am UTC on 17 January 2006
Dates has a problem in Squeak

Print this

'01/01/1' asDate -> 1 January 2001
Althoug Date class admits any date, you can't create a year of first century from a string () "
'01/01/50' asDate ->1 January 1950 "year 50 existed. year 2050 will exist"

Date newDay:1 month:1 year:1 1 January 2001 "() nor from Date class"
Date newDay:1 month:1 year:-1 1 January 1999 "Auch!"

I made some enhacements on Date class to make this possible here Dates.cs.

For compatibility reasons, I made other methods to instantiate these kind of dates:

'01/01/01' asHistoricalDate 01/01/0001
'01/01/51' asHistoricalDate 01/01/0051

Date newHistoricalDay:1 month:1 year:1
Date newHistoricalDate:1 month:1 year:-1 01/01/-0001 "well, year -1 existed too"
'20010101' asHistoricalDate 01/01/2001 "from ISO format, usually found in data bases"

I added the Year Class too, that acts similarly to Month class.
And some convinience methods for printing.