Date.js
[roojs1] / Date.js
diff --git a/Date.js b/Date.js
index 1eabc5b..92a92db 100644 (file)
--- a/Date.js
+++ b/Date.js
@@ -47,8 +47,7 @@ Format  Output      Description
   H      15         24-hour format of an hour with leading zeros
   i      05         Minutes with leading zeros
   s      01         Seconds, with leading zeros
-  O      -0600      Difference to Greenwich time (GMT) in hours
-  o      -06        Difference to Greenwich time (GMT) in hours without minutes.. (postgresql outputs this.)
+  O      -0600      Difference to Greenwich time (GMT) in hours (Allows +08, without minutes)
   P      -06:00     Difference to Greenwich time (GMT) with colon between hours and minutes
   T      CST        Timezone setting of the machine running the code
   Z      -21600     Timezone offset in seconds (negative if west of UTC, positive if east)
@@ -274,6 +273,7 @@ Date.createParser = function(format) {
         + "y = d.getFullYear();\n"
         + "m = d.getMonth();\n"
         + "d = d.getDate();\n"
+        + "if (typeof(input) !== 'string') { input = input.toString(); }\n"
         + "var results = input.match(Date.parseRegexes[" + regexNum + "]);\n"
         + "if (results && results.length > 0) {";
     var regex = "";
@@ -358,7 +358,7 @@ Date.formatCodeToRegex = function(character, currentGroup) {
             s:"(?:\\d{2})"};
     case "F":
         return {g:1,
-            c:"m = parseInt(Date.monthNumbers[results[" + currentGroup + "].substring(0, 3)], 10);\n",
+            c:"m = parseInt(Date.monthNumbers[results[" + currentGroup + "].substring(0, 3)], 10); d = 1;\n",
             s:"(" + Date.monthNames.join("|") + ")"};
     case "M":
         return {g:1,