From: Artur Signell Date: Thu, 19 Feb 2009 14:54:02 +0000 (+0000) Subject: Fix for #2629 - Internal Error when invalid date is entered into textfield X-Git-Tag: 6.7.0.beta1~3106 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ac6e88b05b67e4297ed9b7a25857026ad42cdd70;p=vaadin-framework.git Fix for #2629 - Internal Error when invalid date is entered into textfield svn changeset:6909/svn branch:trunk --- diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/ITextualDate.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/ITextualDate.java index 6c51b33b67..c7e48f6afd 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/ITextualDate.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/ITextualDate.java @@ -139,8 +139,15 @@ public class ITextualDate extends IDateField implements Paintable, Field, if (sender == text) { if (!text.getText().equals("")) { try { - date = DateTimeFormat.getFormat(getFormatString()).parse( - text.getText()); + DateTimeFormat format = DateTimeFormat + .getFormat(getFormatString()); + date = format.parse(text.getText()); + long stamp = date.getTime(); + if (stamp == 0) { + // If date parsing fails in firefox the stamp will be 0 + date = null; + } + // remove possibly added invalid value indication removeStyleName(PARSE_ERROR_CLASSNAME); } catch (final Exception e) {