2002/07/02 00:18:00
[org.ibex.core.git] / src / org / xwt / XMLRPC.java
index e2ea79b..30cc98c 100644 (file)
@@ -227,6 +227,26 @@ class XMLRPC extends XML implements Function {
             }
             sb.append("</string></value>\n");
 
+        } else if (o instanceof NativeDate) {
+            sb.append("                <value><dateTime.iso8601>");
+            NativeDate nd = (NativeDate)o;
+            Date d = new Date(nd.getRawTime());
+            sb.append(d.getYear() + 1900);
+            if (d.getMonth() + 1 < 10) sb.append('0');
+            sb.append(d.getMonth() + 1);
+            if (d.getDate() < 10) sb.append('0');
+            sb.append(d.getDate());
+            sb.append('T');
+            if (d.getHours() < 10) sb.append('0');
+            sb.append(d.getHours());
+            sb.append(':');
+            if (d.getMinutes() < 10) sb.append('0');
+            sb.append(d.getMinutes());
+            sb.append(':');
+            if (d.getSeconds() < 10) sb.append('0');
+            sb.append(d.getSeconds());
+            sb.append("</dateTime.iso8601></value>\n");
+
         } else if (o instanceof NativeArray) {
             if (tracker.get(o) != null) throw new JavaScriptException("attempted to send multi-ref data structure via XML-RPC");
             tracker.put(o, Boolean.TRUE);