bug4210 Integrated parser fallback for time input in Google Chrome

This commit is contained in:
Benjamin Barth committed 2017-12-05 12:13:22 +01:00
1 parent 0f18e14e95
commit a332040774
1 file changed
+9 -8
@@ -3,7 +3,6 @@ package com.sap.sse.gwt.client.controls.datetime;
import java.util.Date;
import java.util.Objects;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.InputElement;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
@@ -83,17 +82,19 @@ class NativeDateTimeInput extends Widget implements DateTimeInput {
try {
return this.format.parse(input.getValue());
} catch (IllegalArgumentException exc) {
if(format == Accuracy.SECONDS.getDatetimeFormat()){
try {
GWT.log("Fallback parsing with minute only");
//at least chrome omits the seconds if they are 00 in input field
try {
// at least Google Chrome omits the seconds, if they are 00 in input field
if (format == Accuracy.SECONDS.getDatetimeFormat()) {
return Accuracy.MINUTES.getDatetimeFormat().parse(input.getValue());
} catch (IllegalArgumentException exc2) {
return null;
}
if (format == Accuracy.SECONDS.getTimeFormat()) {
return Accuracy.MINUTES.getTimeFormat().parse(input.getValue());
}
} catch (IllegalArgumentException exc2) {
return null;
}
return null;
}
return null;
}
@Override