Fix DateTimeFormat parsing for non-initial adjacent numeric fields.
Fixes issue 7823.
Review-Link: http://gwt-code-reviews.appspot.com/1872804
Review by: goktug@google.com
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@11484 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/i18n/shared/DateTimeFormat.java b/user/src/com/google/gwt/i18n/shared/DateTimeFormat.java
index 7996850..471314d 100644
--- a/user/src/com/google/gwt/i18n/shared/DateTimeFormat.java
+++ b/user/src/com/google/gwt/i18n/shared/DateTimeFormat.java
@@ -1473,7 +1473,7 @@
if (part.count > 0) {
if (abutPat < 0 && part.abutStart) {
abutPat = i;
- abutStart = start;
+ abutStart = parsePos[0];
abutPass = 0;
}
diff --git a/user/test/com/google/gwt/i18n/client/DateTimeParse_en_Test.java b/user/test/com/google/gwt/i18n/client/DateTimeParse_en_Test.java
index 54d4803..7360286 100644
--- a/user/test/com/google/gwt/i18n/client/DateTimeParse_en_Test.java
+++ b/user/test/com/google/gwt/i18n/client/DateTimeParse_en_Test.java
@@ -74,6 +74,11 @@
assertEquals(9 - 1900, date.getYear());
assertEquals(12 - 1, date.getMonth());
assertEquals(2, date.getDate());
+
+ assertEquals(6, parse("dd HHmm", "11 213", 0, date));
+ assertEquals(11, date.getDate());
+ assertEquals(2, date.getHours());
+ assertEquals(13, date.getMinutes());
}
public void testAmbiguousYear() {