flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcl...@apache.org
Subject [22/25] git commit: [flex-sdk] [refs/heads/release4.11.0] - FLEX-33807 fixed parsing of dates with no seperators
Date Tue, 08 Oct 2013 15:23:01 GMT
FLEX-33807 fixed parsing of dates with no seperators


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/7639423c
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/7639423c
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/7639423c

Branch: refs/heads/release4.11.0
Commit: 7639423c798492a4673f32a73e333a9cea75163a
Parents: 6cf64f2
Author: Justin Mclean <jmclean@apache.org>
Authored: Wed Oct 9 02:11:08 2013 +1100
Committer: Justin Mclean <jmclean@apache.org>
Committed: Wed Oct 9 02:11:08 2013 +1100

----------------------------------------------------------------------
 .../framework/src/mx/validators/DateValidator.as         | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/7639423c/frameworks/projects/framework/src/mx/validators/DateValidator.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/framework/src/mx/validators/DateValidator.as b/frameworks/projects/framework/src/mx/validators/DateValidator.as
index b082502..89138cc 100644
--- a/frameworks/projects/framework/src/mx/validators/DateValidator.as
+++ b/frameworks/projects/framework/src/mx/validators/DateValidator.as
@@ -173,6 +173,7 @@ public class DateValidator extends Validator
 		
 		var part:int = -1;
 		var lastFormatChar:String = "";
+		var noSeperators:Boolean = true;
 		
 		n = inputFormat.length;
 		for (i = 0; i < n; i++)
@@ -209,6 +210,7 @@ public class DateValidator extends Validator
 			}
 			else
 			{
+				noSeperators = false;
 				formatParts[part] = formatChar;
 			}
 			
@@ -318,6 +320,7 @@ public class DateValidator extends Validator
 			else
 			{
 				var lastStringChar:String = "";
+				lastFormatChar = "";
 				n = stringValue.length;
 				part = -1;
 				for (i = 0; i < n; i++)
@@ -327,6 +330,7 @@ public class DateValidator extends Validator
 						&& (lastStringChar != "");
 					var curentIsDigit:Boolean = (DECIMAL_DIGITS.indexOf(stringChar) >= 0);
 					
+					formatChar = inputFormat.charAt(i);
 					if (validInput.indexOf(stringChar) == -1)
 					{
 						results.push(new ValidationResult(
@@ -339,12 +343,19 @@ public class DateValidator extends Validator
 						part++;
 						dateParts[part] = stringChar;
 					}
+					//  TODO will only work if month and day are not specified as single digits
+					else if (lastFormatChar != formatChar && noSeperators)
+					{
+						part++;
+						dateParts[part] = stringChar;
+					}
 					else
 					{
 						dateParts[part] += stringChar;
 					}
 
 					lastStringChar = stringChar;
+					lastFormatChar = formatChar;
 				}
 				
 				if (formatParts.length != dateParts.length)


Mime
View raw message