repaired bug where parsing intervals with months failed becuase dojo.date.add() wants...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 2 Jul 2010 19:41:43 +0000 (19:41 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 2 Jul 2010 19:41:43 +0000 (19:41 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16846 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/openils/Util.js

index f535e22..fd3a2d1 100644 (file)
@@ -222,8 +222,17 @@ if(!dojo._hasResource["openils.Util"]) {
         var d = new Date();
         var start = d.getTime();
         var parts = interval.split(' ');
-        for(var i = 0; i < parts.length; i += 2) 
-            d = dojo.date.add(d, parts[i+1].replace(/s?,?$/,''), Number(parts[i]));
+        for(var i = 0; i < parts.length; i += 2)  {
+            var type = parts[i+1].replace(/s?,?$/,'');
+            switch(type) {
+                case 'mon': // postgres
+                    type = 'month'; // dojo
+                    break;
+                // add more as necessary
+            }
+
+            d = dojo.date.add(d, type, Number(parts[i]));
+        }
         return Number((d.getTime() - start) / 1000);
     };