r9437 - apps/modules/trunk/core

[email protected]
Newsgroups gmane.comp.java.helma.cvs
Message-ID <[email protected]>
Author: zumbrunn
Date: 2008-12-16 14:23:33 +0100 (Tue, 16 Dec 2008)
New Revision: 9437

Modified:
   apps/modules/trunk/core/Global.js
Log:
patch by tobi, catching invalid date format errors and letting the now_macro write error output into the skin instead

Details at http://dev.helma.org/trac/helma/changeset/9437

Modified: apps/modules/trunk/core/Global.js
===================================================================
--- apps/modules/trunk/core/Global.js	2008-12-15 22:52:18 UTC (rev 9436)
+++ apps/modules/trunk/core/Global.js	2008-12-16 13:23:33 UTC (rev 9437)
@@ -52,7 +52,11 @@
 function now_macro(param) {
     var d = new Date();
     if (param.format) {
-        res.write(d.format(param.format));
+        try {
+            res.write(d.format(param.format));
+        } catch (e) {
+            res.write('<span title="' + e + '">[Invalid date format]</span>');
+        }
     } else if (param.as == "timestamp") {
         res.write(d.getTime());
     } else {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.