In writeDateTime, only prepend a 0 if the hex string has odd length
diff --git a/js/encoding/BinaryXMLEncoder.js b/js/encoding/BinaryXMLEncoder.js
index de03875..99a1ad2 100644
--- a/js/encoding/BinaryXMLEncoder.js
+++ b/js/encoding/BinaryXMLEncoder.js
@@ -330,9 +330,11 @@
 
 	//parse to hex
 	var binarydate =  Math.round((dateTime.msec/1000) * 4096).toString(16)  ;
+  if (binarydate.length % 2 == 1)
+    binarydate = '0' + binarydate;
 
-	//HACK
-	var binarydate =  DataUtils.toNumbers( '0'.concat(binarydate,'0')) ;
+  // Hack toNumbers by appending a 0 which is ignored.
+	var binarydate =  DataUtils.toNumbers( binarydate + '0') ;
 
 	
 	if(LOG>4)console.log('ENCODING DATE with BINARY VALUE');