You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2010/06/21 09:56:12 UTC

svn commit: r956479 - in /myfaces/tobago/trunk: tobago-example/tobago-example-demo/src/main/webapp/reference/time.jsp tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/calendar.js

Author: lofwyr
Date: Mon Jun 21 07:56:12 2010
New Revision: 956479

URL: http://svn.apache.org/viewvc?rev=956479&view=rev
Log:
TOBAGO-894: Support date pattern "MM.yyyy" for <tx/tc:date>

Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/time.jsp
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/calendar.js

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/time.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/time.jsp?rev=956479&r1=956478&r2=956479&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/time.jsp (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/time.jsp Mon Jun 21 07:56:12 2010
@@ -1,4 +1,4 @@
-<%@ page import="java.util.Date" %>
+<%@ page import="java.text.SimpleDateFormat" %>
 <%--
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -21,14 +21,14 @@
 <%@ taglib tagdir="/WEB-INF/tags/layout" prefix="layout" %>
 
 <%
-  request.setAttribute("now", new Date(100000000000L));
+  request.setAttribute("now", new SimpleDateFormat("yyyy-MM-dd").parse("1980-03-22"));
 %>
 
 <layout:overview>
   <jsp:body>
       <tc:box label="Time Specific Controls">
         <f:facet name="layout">
-          <tc:gridLayout columns="400px;*" rows="fixed;fixed;fixed;fixed;fixed;fixed;fixed;250px;*"/>
+          <tc:gridLayout columns="400px;*" rows="fixed;fixed;fixed;fixed;fixed;fixed;fixed;fixed;fixed;250px;*"/>
         </f:facet>
         <%-- code-sniplet-start id="date" --%>
         <tx:date label="Date" value="#{now}">
@@ -69,6 +69,16 @@
         </tx:date>
         <tc:cell/>
 
+        <tx:date label="Month" value="#{now}">
+          <f:convertDateTime pattern="MM/yyyy"/>
+        </tx:date>
+        <tc:cell/>
+
+        <tx:date label="Year" value="#{now}">
+          <f:convertDateTime pattern="yyyy"/>
+        </tx:date>
+        <tc:cell/>
+
         <%-- code-sniplet-start id="calendar" --%>
         <tc:calendar />
         <%-- code-sniplet-end id="calendar" --%>
@@ -78,4 +88,4 @@
 
       </tc:box>
   </jsp:body>
-</layout:overview>
\ No newline at end of file
+</layout:overview>

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/calendar.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/calendar.js?rev=956479&r1=956478&r2=956479&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/calendar.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/calendar.js Mon Jun 21 07:56:12 2010
@@ -209,6 +209,9 @@ function initCalendarParse(id, textBoxId
   var date = new Date(getDateFromFormat(string, document.calendar.formatPattern));
   if (date.getTime() == 0) {
     date = new Date();
+  } else if (! document.calendar.formatPattern.match(/d/)) {
+    // XXX Workaround for patterns without day (d) like mm/yyyy (repair the result from parsing)
+    date.setDate(date.getDate() + 1);
   }
   var day = date.getDate();
   var month = date.getMonth() + 1;