myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1746412 - /myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-calendar.js
Date Wed, 01 Jun 2016 08:09:05 GMT
Author: lofwyr
Date: Wed Jun  1 08:09:04 2016
New Revision: 1746412

URL: http://svn.apache.org/viewvc?rev=1746412&view=rev
Log:
TOBAGO 1483   
* can now handle escape characters   bugfix  Z Pattern
[developed by hnoeth]

Modified:
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-calendar.js

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-calendar.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-calendar.js?rev=1746412&r1=1746411&r2=1746412&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-calendar.js
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-calendar.js
Wed Jun  1 08:09:04 2016
@@ -134,7 +134,40 @@ Tobago.DateTime.analyzePattern = functio
     console.warn("Pattern not supported: " + pattern);  // @DEV_ONLY
     pattern = "";
   }
-  if(pattern.search("G") > -1 || pattern.search("W") > -1 || pattern.search("F") >
-1
+
+  var analyzedPattern = "";
+  var nextSegment = "";
+  var escMode = false;
+  for (i = 0; i < pattern.length; i++) {
+    var currentChar = pattern.charAt(i);
+    if (currentChar == "'" && escMode == false) {
+      escMode = true;
+      analyzedPattern += Tobago.DateTime.analyzePatternPart(nextSegment);
+      nextSegment = "";
+    } else if (currentChar == "'" && pattern.charAt(i + 1) == "'") {
+      if (escMode) {
+        nextSegment += "\\";
+      }
+      nextSegment += "'";
+      i++;
+    } else if (currentChar == "'" && escMode == true) {
+      escMode = false;
+      analyzedPattern += nextSegment;
+      nextSegment = "";
+    } else {
+      if (escMode) {
+        nextSegment += "\\";
+      }
+      nextSegment += currentChar;
+    }
+  }
+
+  return analyzedPattern;
+};
+
+Tobago.DateTime.analyzePatternPart = function (pattern) {
+
+  if (pattern.search("G") > -1 || pattern.search("W") > -1 || pattern.search("F") >
-1
       || pattern.search("K") > -1 || pattern.search("z") > -1 || pattern.search("X")
> -1) {
     console.warn("Pattern chars 'G', 'W', 'F', 'K', 'z' and 'X' are not supported: " + pattern);
// @DEV_ONLY
     pattern = "";
@@ -197,7 +230,8 @@ Tobago.DateTime.analyzePattern = functio
   if (pattern.search("SSSS") > -1) {
     pattern = pattern.replace(/SSSS+/g, "SSS");
   }
-  if (pattern.search("ZZZ") > -1) {
+  if (pattern.search("Z") > -1) {
+    pattern = pattern.replace(/\bZ\b/g, "ZZ");
     pattern = pattern.replace(/ZZZ+/g, "ZZ");
   }
 



Mime
View raw message