summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorAnastasia Smirnova <anasmi@utu.fi>2018-04-16 10:26:15 +0300
committerTeemu Suo-Anttila <tsuoanttila@users.noreply.github.com>2018-04-20 15:19:23 +0300
commitba5f3777795386d77fb7805c035f06a3b0a1dac0 (patch)
tree5e455aa97b76782b669cfaaf7e6e2d1829cf89e3 /server
parent8e61228f214d12efb80acfc0336196c2272b84e5 (diff)
downloadvaadin-framework-ba5f3777795386d77fb7805c035f06a3b0a1dac0.tar.gz
vaadin-framework-ba5f3777795386d77fb7805c035f06a3b0a1dac0.zip
Handle UnparsableDateString correctly (#10803)
Resolves #10681
Diffstat (limited to 'server')
-rw-r--r--server/src/main/java/com/vaadin/ui/AbstractDateField.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/server/src/main/java/com/vaadin/ui/AbstractDateField.java b/server/src/main/java/com/vaadin/ui/AbstractDateField.java
index 19b628b1f2..a4677e6ec3 100644
--- a/server/src/main/java/com/vaadin/ui/AbstractDateField.java
+++ b/server/src/main/java/com/vaadin/ui/AbstractDateField.java
@@ -38,6 +38,7 @@ import java.util.logging.Logger;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+import elemental.json.Json;
import org.jsoup.nodes.Element;
import com.googlecode.gentyref.GenericTypeReflector;
@@ -119,7 +120,17 @@ public abstract class AbstractDateField<T extends Temporal & TemporalAdjuster &
if (resolutions.isEmpty()) {
Result<T> parsedDate = handleUnparsableDateString(
dateString);
- parsedDate.ifOk(v -> setValue(v, true));
+ // If handleUnparsableDateString returns the same
+ // date as current, force update state to display
+ // correct representation
+ parsedDate.ifOk(v -> {
+ if (!setValue(v, true)
+ && !isDifferentValue(v)) {
+ updateDiffstate("resolutions",
+ Json.createObject());
+ doSetValue(v);
+ }
+ });
if (parsedDate.isError()) {
dateString = null;
currentParseErrorMessage = parsedDate