Date.st
changeset 12661 59e95e072773
parent 12168 d09cdbb899ff
child 12663 b64be8b3cd88
--- a/Date.st	Wed Jan 27 15:07:56 2010 +0100
+++ b/Date.st	Wed Jan 27 15:08:06 2010 +0100
@@ -756,6 +756,7 @@
     "
 ! !
 
+
 !Date class methodsFor:'change & update'!
 
 update:something with:aParameter from:changedObject
@@ -1539,6 +1540,13 @@
     "
 ! !
 
+!Date class methodsFor:'spray'!
+
+sprayTypeName
+	#swAdded.
+	^SOAP::XePName xsd: 'date'
+! !
+
 !Date methodsFor:'Compatibility-ANSI'!
 
 dayOfWeek
@@ -2541,6 +2549,11 @@
     ^ self
 !
 
+asNative
+	#swAdded.
+	^self
+!
+
 asTimestamp
     "return an TimeStamp instance, representing midnight of last night"
 
@@ -2611,6 +2624,33 @@
     ^ self addDays:days
 ! !
 
+!Date methodsFor:'printing'!
+
+printUnboundedSchemaStringOn: stream
+	"If a Date is prior to 01 January 1601, or post 31 December 65535, then it cannot be
+	formatted by Windows. ... and the Dolphin printUnboundedDate method does not respect the format string"
+
+	#swAdded.
+	stream
+		display: self year;
+		nextPut: $-;
+		display: (self monthIndex printStringRadix: 10 padTo: 2);
+		nextPut: $-;
+		display: (self dayOfMonth printStringRadix: 10 padTo: 2).
+!
+
+schemaDisplayString
+	"Answer a valid XMLSchema  xsd:date lexical representation"
+	"Assume UTC"
+
+	| stream |
+	#swAdded.
+	stream := String writeStream.
+	self printUnboundedSchemaStringOn: stream.
+	stream nextPut: $Z.
+	^stream contents
+! !
+
 !Date methodsFor:'printing & storing'!
 
 addPrintBindingsTo:aDictionary
@@ -2656,7 +2696,7 @@
 
     |day ds dsPadded0 dsPaddedB month ms msPadded0 msPaddedB 
      year weekInYear monthName shortMonthName 
-     dayInWeek dayOfWeek dayName shortDayName ws wsPadded0|
+     dayInWeek dayOfWeek dayName shortDayName ws wsPadded0 t|
 
     day := self day.
     ds := day printString.
@@ -2700,13 +2740,21 @@
     ].
 
     aDictionary at:$d put:dsPadded0.
+    aDictionary at:#d put:dsPadded0.
     aDictionary at:$D put:ds.
+    aDictionary at:#D put:ds.
     aDictionary at:$m put:msPadded0.
+    aDictionary at:#m put:msPadded0.
     aDictionary at:$M put:ms.
+    aDictionary at:#M put:ms.
     aDictionary at:$y put:year.
-    aDictionary at:$Y put:((year \\ 100)printStringLeftPaddedTo:2 with:$0).
+    aDictionary at:#y put:year.
+    aDictionary at:$Y put:(t := (year \\ 100) printStringLeftPaddedTo:2 with:$0).
+    aDictionary at:#Y put:t.
     aDictionary at:$w put:wsPadded0.
+    aDictionary at:#w put:wsPadded0.
     aDictionary at:$W put:ws.
+    aDictionary at:#W put:ws.
 
     aDictionary at:#monthName put:monthName.
     aDictionary at:#monthname put:monthName.
@@ -2953,11 +3001,11 @@
 !Date class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Date.st,v 1.129 2009-10-07 15:33:07 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Date.st,v 1.130 2010-01-27 14:08:06 sr Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Date.st,v 1.129 2009-10-07 15:33:07 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Date.st,v 1.130 2010-01-27 14:08:06 sr Exp $'
 ! !
 
 Date initialize!