]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix for #2629 - Internal Error when invalid date is entered into textfield
authorArtur Signell <artur.signell@itmill.com>
Thu, 19 Feb 2009 14:54:02 +0000 (14:54 +0000)
committerArtur Signell <artur.signell@itmill.com>
Thu, 19 Feb 2009 14:54:02 +0000 (14:54 +0000)
svn changeset:6909/svn branch:trunk

src/com/itmill/toolkit/terminal/gwt/client/ui/ITextualDate.java

index 6c51b33b67242f662726fa2caf56f7ff9b246c9a..c7e48f6afd7a8a1d1e2eea7474c5956dccc39f1d 100644 (file)
@@ -139,8 +139,15 @@ public class ITextualDate extends IDateField implements Paintable, Field,
         if (sender == text) {\r
             if (!text.getText().equals("")) {\r
                 try {\r
-                    date = DateTimeFormat.getFormat(getFormatString()).parse(\r
-                            text.getText());\r
+                    DateTimeFormat format = DateTimeFormat\r
+                            .getFormat(getFormatString());\r
+                    date = format.parse(text.getText());\r
+                    long stamp = date.getTime();\r
+                    if (stamp == 0) {\r
+                        // If date parsing fails in firefox the stamp will be 0\r
+                        date = null;\r
+                    }\r
+\r
                     // remove possibly added invalid value indication\r
                     removeStyleName(PARSE_ERROR_CLASSNAME);\r
                 } catch (final Exception e) {\r