Date.st
changeset 4413 a416c8ebf71c
parent 4408 3d76920644f6
child 4421 9ecd9ba9faa4
--- a/Date.st	Mon Jul 19 21:09:50 1999 +0200
+++ b/Date.st	Mon Jul 19 21:26:09 1999 +0200
@@ -1117,12 +1117,14 @@
      2   month position (1..3)
      3   year position (1..3)
      4   asciiValue of separator character or separator character
-	 or collection of 2 separator characters
+         or collection of 2 separator characters
      5   month format (1: numeric; 2: abbreviated name; 3: fullname
-	 4: abbreviated uppercase 5: full uppercase)
+         4: abbreviated uppercase 5: full uppercase)
      6   year format (1 include century; 2 exclude century)
-     7 (optional) true/false of true, print numbers in 2-digit format
-		  False, if ommited
+     7  (optional) true/false.
+         if true, print numbers in 2-digit format
+         (i.e. with leading zeros); 
+         Taken as false, if ommited
 
      Day and monthnames are in the currently active language.
 
@@ -1130,22 +1132,25 @@
      4 and 5, non-numeric separators and the optional 7th parameter are not 
      supported by ST-80. Be aware of this for compatibility reasons.
 
-     Notice that not all formats can be scanned (correctly) by #readFrom:"
+     Notice that not all formats can be scanned (correctly) by #readFrom:
+     This is an ST-80 compatibility method - I would have choosen another
+     (less cryptic) formatString ...
+    "
 
     |mf upperCase day month year components sep1 sep2 leadingZeros|
 
     aFormatArray size > 6 ifTrue:[
-	leadingZeros := aFormatArray at:7
+        leadingZeros := aFormatArray at:7
     ] ifFalse:[
-	leadingZeros := false.
+        leadingZeros := false.
     ].
 
     components := Array new:3.
     day := self day.
     leadingZeros ifTrue:[
-	day := day printStringLeftPaddedTo:2 with:$0 
+        day := day printStringLeftPaddedTo:2 with:$0 
     ] ifFalse:[
-	day := day printString
+        day := day printString
     ].
     components at:(aFormatArray at:1) put:day.
 
@@ -1154,34 +1159,34 @@
     (mf between:4 and:5) ifTrue:[mf := mf - 2. upperCase := true].
 
     mf == 1 ifTrue:[
-	month := self month.
-	leadingZeros ifTrue:[
-	    month := month printStringLeftPaddedTo:2 with:$0 
-	] ifFalse:[
-	    month := month printString
-	]
+        month := self month.
+        leadingZeros ifTrue:[
+            month := month printStringLeftPaddedTo:2 with:$0 
+        ] ifFalse:[
+            month := month printString
+        ]
     ] ifFalse:[
-	mf == 2 ifTrue:[
-	    month := self abbreviatedMonthName
-	] ifFalse:[
-	    month := self monthName
-	]
+        mf == 2 ifTrue:[
+            month := self abbreviatedMonthName
+        ] ifFalse:[
+            month := self monthName
+        ]
     ].
     upperCase ifTrue:[month := month asUppercase].
     components at:(aFormatArray at:2) put:month.
 
     year := self year.
     (aFormatArray at:6) == 2 ifTrue:[
-	year := year \\ 100
+        year := year \\ 100
     ].
     components at:(aFormatArray at:3) put:year printString.
 
     sep1 := (aFormatArray at:4).
     sep1 isCollection ifTrue:[
-	sep2 := (sep1 at:2).
-	sep1 := (sep1 at:1).
+        sep2 := (sep1 at:2).
+        sep1 := (sep1 at:1).
     ] ifFalse:[
-	sep1 := sep2 := sep1 asCharacter
+        sep1 := sep2 := sep1 asCharacter
     ].
 
     ^ (components at:1)
@@ -1191,9 +1196,9 @@
       , (components at:3)
 
     "
-     Date today printFormat:#(1 2 3 $- 1 2)   
-     Date today printFormat:#(1 2 3 $. 1 2 true)  
-     Date today printFormat:#(2 1 3 32 3 1)  
+     Date today printFormat:#(1 2 3 $- 1 2)          
+     Date today printFormat:#(1 2 3 $. 1 2 true)     
+     Date today printFormat:#(2 1 3 32 3 1)          
      Date today printFormat:#(2 1 3 #(' ' ', ') 3 1)  
      Date today printFormat:#(1 2 3 $- 2 1)    
      Date today printFormat:#(1 2 3 $- 4 1)    
@@ -1294,6 +1299,6 @@
 !Date class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Date.st,v 1.44 1999-07-19 16:35:37 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Date.st,v 1.45 1999-07-19 19:26:09 cg Exp $'
 ! !
 Date initialize!