You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2010/05/02 02:59:05 UTC

svn commit: r940129 - /myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/dateformat/SimpleDateFormatter.java

Author: lu4242
Date: Sun May  2 00:59:05 2010
New Revision: 940129

URL: http://svn.apache.org/viewvc?rev=940129&view=rev
Log:
TOMAHAWK-1425 Support to java.sql.Date using inputCalendar tag.

Modified:
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/dateformat/SimpleDateFormatter.java

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/dateformat/SimpleDateFormatter.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/dateformat/SimpleDateFormatter.java?rev=940129&r1=940128&r2=940129&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/dateformat/SimpleDateFormatter.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/dateformat/SimpleDateFormatter.java Sun May  2 00:59:05 2010
@@ -1212,12 +1212,26 @@ public class SimpleDateFormatter
 
     public String format(Date date)
     {
-        return formatOps(symbols, yearIsWeekYear, firstDayOfWeek, ops, date);
+        if (date instanceof java.sql.Date)
+        {
+            return formatOps(symbols, yearIsWeekYear, firstDayOfWeek, ops, new Date(date.getTime()));
+        }
+        else
+        {
+            return formatOps(symbols, yearIsWeekYear, firstDayOfWeek, ops, date);
+        }
     }
     
     public WeekDate getWeekDate(Date date)
     {
-        return getWeekDate(date, this.firstDayOfWeek);
+        if (date instanceof java.sql.Date)
+        {
+            return getWeekDate(new Date(date.getTime()), this.firstDayOfWeek);
+        }
+        else
+        {
+            return getWeekDate(date, this.firstDayOfWeek);
+        }
     }
     
     public Date getDateForWeekDate(WeekDate wdate)